Teddy Fernandez Teddy Fernandez - 1 year ago 77
Java Question

How to record current X and Y co-ordinates of a Component (like a Button) into a Variable in a JFrameForm in Netbeans

Well the question I have is exactly what the topic says .. I simply want to record the X and Y co-ordinates of a component like a JTextField or a Jbutton into variables in a JFrameForm in Netbeans. I searched all around the internet for an answer .. there wasn't one.. maybe this is Impossible if so please tell me so.

Thanks in Advance

Answer Source

Yes my friend, it's possible and it's simple.
Assume you want to get the location of a jButton the all you have to do is.

Point p = jButton.getLocation();

Please correct me if i'm wrong.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download