-
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.
-
This is a C++ programming board incase you forgot :confused:
I sometimes go on a board at www.javaranch.com
-
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
-
I am sorry
I am not a java expert too...
Sorry for that...
Good luck