Java examples for Swing:JTextField
Get X and Y Coordinates of JTextField
import java.awt.FlowLayout; import javax.swing.JApplet; import javax.swing.JLabel; import javax.swing.JTextField; public class Main { public void init(){ JTextField field = new JTextField("JTextField X Y Coordinates Example",20); /*from w w w . j av a 2 s.c om*/ int x = field.getX(); int y = field.getY(); } }