Get X and Y Coordinates of JTextField - Java Swing

Java examples for Swing:JTextField

Description

Get X and Y Coordinates of JTextField

Demo Code

 
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();
        }
}

Related Tutorials