Results 1 to 5 of 5
  1. #1
    silvia is offline Member
    Join Date
    Jul 2007
    Rep Power

    Default I need simple java applet

    Hi, I was wondering if someone can show me how to make a simple java applet with some buttons like submit and reset and maybe some others?


  2. #2
    barney is offline Member
    Join Date
    Jul 2007
    Rep Power


    Check this:
    Decent tutorials to get started with and it shows you source code to look at.

  3. #3
    thejdev is offline Member
    Join Date
    Jan 2008
    Rep Power


    Hi i'm a newbie and i tried that hello world example except that i renamed it to . I tried to view it on a html page using hotjava 3.0 and i get these exceptions when i do

    PHP Code:
    java.lang.ClassNotFoundException: ?HelloApplet.class?
    	at sunw.hotjava.applet.BasicAppletManager.createApplet(
    	at sunw.hotjava.applet.BrowserAppletManager.createApplet(
    	at sunw.hotjava.applet.AppletPanel.runLoader(
    	at sunw.hotjava.applet.AppletPanel.processEvent(
    My HTML document looks like this (html.html)

    PHP Code:
    <TITLE>This page has an applet on it</TITLE>
    <P>My second Java applet says:
    <APPLET CODE = ”HelloApplet.class” WIDTH=200 HEIGHT=50>
    There would be an applet here if your browser
    supported Java.
    And my :

    PHP Code:
    By Bavo Bruylandt (Http://") 
    // and now The inevidable "Hello World" example :) 
    // tell the compiler where to find the methods you will use. 
    // required when you create an applet 
    import java.applet.*; 
    // required to paint on screen 
    import java.awt.*; 
    // the start of an applet - HelloWorld will be the executable class 
    // Extends applet means that you will build the code on the standard Applet class 
    public class HelloApplet extends Applet 
    // The method that will be automatically called  when the applet is started 
         public void init() 
     // It is required but does not need anything. 
    // This method gets called when the applet is terminated 
    // That's when the user goes to another page or exits the browser. 
         public void stop() 
         // no actions needed here now. 
    // The standard method that you have to use to paint things on screen 
    // This overrides the empty Applet method, you can't called it "display" for example. 
         public void paint(Graphics g) 
     //method to draw text on screen 
     // String first, then x and y coordinate. 
          g.drawString("Hey hey hey",20,20); 
          g.drawString("Hellooow World",20,40); 
    // That's it. Next is drawing special shapes on screen and using fonts. 
    // Go to
    I compiled on Forte for Java 4.0 CE

    All files i.e , HelloApplet.class and html.html are in the same directory i.e C:\forte_jdk\forte4j\bin\ide-userdir\sampledir

    Could someone pls tell me where i went wrong ...

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Colombo, Sri Lanka
    Blog Entries
    Rep Power

  5. #5
    sabbirhs is offline Member
    Join Date
    Jan 2008
    Rep Power

Similar Threads

  1. 2 simple java questions
    By jimJohnson in forum New To Java
    Replies: 2
    Last Post: 02-02-2008, 09:35 AM
  2. Simple java
    By abhiN in forum New To Java
    Replies: 0
    Last Post: 01-16-2008, 02:44 PM
  3. Simple java
    By abhiN in forum New To Java
    Replies: 1
    Last Post: 01-16-2008, 10:13 AM
  4. help with simple program in java
    By katie in forum New To Java
    Replies: 2
    Last Post: 08-06-2007, 08:03 PM
  5. help with simple java program
    By leonard in forum New To Java
    Replies: 3
    Last Post: 07-30-2007, 09:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts