Hi Gary,
For that AWT help...I tried that..but it's not letting me do that..now let me write u the details...
I am using Swing & JDK1.3 now in my applet the layout is something like this..
container cPane = getContentPane();
cPane.add(JSP,CENTER) (JSP is a JScrollPane)
cPane.add(toolbar,SOUTH) (toolbar is a JToolbar)
Now I am using a JEditorPane which is inside the JScrollPane..and on that I want to put a textbox anywhere I click the mouse...
So I tried as u said but it's now working...though it's not giving any errors too !So if I want to keep my layout intact..how should I do ..?
any help from u would be higly appriciated
thanks
Pratik Khetia
Originally posted by Gary Bryan:
You need to set the layout manager to null, add the textfield to the container you want it on, then use the setLocation method to set its position.
(on the container you want)
TextField tf;
...
tf = new TextField(10);
add(tf);
setLayout(null);
...
public void mousePressed(MouseEvent e) {
tf.setLocation(50, 50);
}
would set the location of the textfield's top-left corner to 50,50.
If you want to set it to where the mouse was clicked, use
tf.setLocation(e.getPoint());
Hope this helps.