<pre> import java.awt.*; import java.awt.event.*; class TextBox extends Frame implements KeyListener{ TextField t1; void createtext(){ System.out.println("create text"); t1 = new TextField(); add(t1); setLayout(new FlowLayout()); setVisible(true); setSize(200,400); t1.addKeyListener(this); } public void keyPressed(KeyEvent e){ if (e.getKeyCode() == 10){ System.out.println("fdaSD"); } } public void keyReleased(KeyEvent e){ } public void keyTyped(KeyEvent e){ }
} class box extends java.applet.Applet{ public void init(){ System.out.println("hai"); TextBox t = new TextBox(); t.createtext(); System.out.println("helloi");
} }
</pre> I am getting message saying applet started but my textbox doresnot appear why???
alberto sierra
Greenhorn
Joined: Mar 21, 2000
Posts: 4
posted
0
Try using the pack() and show() methods in a constructor for your frame or t.pack() and t.show() after new TextBox().
josephine chen
Ranch Hand
Joined: Oct 29, 2002
Posts: 216
posted
0
I am getting the applet but the problem is i am not able to close it. What should I do to close it?
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.