Link to home
Start Free TrialLog in
Avatar of James Hancock
James HancockFlag for United States of America

asked on

Why doesn't this text field show up on my Applet frame?

Hi

In the applet code below, the one numberField textfield doesn't  show, go visible and it is flabbergasting me. wth?


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


public class DokutelaDom extends Applet{


	TextField numberField;
		
	  public void paint(Graphics g) {
	      g.drawString("Astonishing medical app",40,20);
	      numberField = new TextField();
	      numberField.setVisible(true);
	      g.drawLine(40, 70, 600, 70);
	      g.drawString("Patients,  please enter your patient number below", 40,100);
	      numberField.setLocation(40, 2000);
	      numberField.setText("9876");
	      numberField.setSize(100, 40);
	    
	    numberField.setVisible(true);
	    
	      
	      
	   }
	public static void main(String[] args) {
		System.out.println("Dokutela Dom");

	}

}

Open in new window


Thanks
Avatar of James Hancock
James Hancock
Flag of United States of America image

ASKER

IF I do

 add(numberField);

Then it prints hundreds of new txt fields racing along the screen

Thanks
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial