Simple java program!!!

This is a discussion on Simple java program!!! within the C++ Programming forums, part of the General Programming Boards category; import java.awt.*; import java.applet.*; public class acceptvalues extends applet { Textfield textfield; public void init(); { textfield=new textfield(10); add(textfield); } ...

  1. #1
    Nicholas
    Guest

    Simple java program!!!

    import java.awt.*;
    import java.applet.*;

    public class acceptvalues extends applet
    {
    Textfield textfield;
    public void init();
    {
    textfield=new textfield(10);
    add(textfield);
    }
    public void paint(Graphics g)
    {
    g.drawstring("The value is:",100,100);
    }
    public boolean action(Event event,object arg)
    {
    repaint();
    return true;
    }
    }


    is there anyone there can xplain this piece of coding for me as i am newbiez in java?thanks a lot.

  2. #2
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    This is a C++ programming board incase you forgot
    I sometimes go on a board at www.javaranch.com

  3. #3
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,493
    Code:
    import java.awt.*;   //import statements include other classes into this code piece
    import java.applet.*;
    
    public class acceptvalues extends applet   //create a public class named acceptvalues which is also an applet. (btw, applet should be Applet)
    {
      Textfield textfield; //create a text box
      public void init(); //duh...
      {
        textfield=new textfield(10); //textfield is 10 characters long (i think)
        add(textfield); //not sure
      }
      public void paint(Graphics g)  //everytime the applet needs to be repainted
      { // like when you restore a window with the applet in it, or you drag a window across the applet
        g.drawstring("The value is:",100,100);  //draw graphical text at 100,100
      }
      public boolean action(Event event,object arg) // for mouse clicks, etc..
      {
        repaint();  
        return true;
      }
    }
    i'm no java expert

  4. #4
    Registered User
    Join Date
    Apr 2002
    Posts
    249

    I am sorry

    I am not a java expert too...
    Sorry for that...
    Good luck
    C++
    The best

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 01:27 PM
  2. [Help] Simple Array/Pointer Program
    By sandwater in forum C Programming
    Replies: 3
    Last Post: 03-30-2007, 03:42 PM
  3. simple silly program
    By verbity in forum C Programming
    Replies: 5
    Last Post: 12-19-2006, 06:06 PM
  4. Simple window program
    By baniakjr in forum C++ Programming
    Replies: 5
    Last Post: 03-11-2006, 03:46 PM
  5. Help with simple program
    By nik2007 in forum C++ Programming
    Replies: 4
    Last Post: 02-27-2006, 09:54 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21