Teddy Fernandez Teddy Fernandez - 9 months ago 52
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


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.