getX « Layout « Java Swing Q&A





1. Why does the getX() getY() of MouseEvent seem to offset from the real coordinate?    stackoverflow.com

I have a JPanel embedded inside a JFrame. JPanle is added at CENTER of BorderLayout. I am using the following code to draw on it but the MouseEvent's getX() and getY() ...

2. JScrollPane getX() returing wrong value ?    stackoverflow.com

I wish to place a small Jframe right above the Button, on ActionPerformed I directly tried to get the X (getX()) and Y(getY()) co-ordinates of the JScrollPane in which the button is ...

3. getX and getY not updated when maximized    coderanch.com

Shows a dialog in the middle relative to a frame. How to reproduce: 1. debug the method 2. show a dialog with a normal(unmaximized frame), note the x and y. 3. maximize the frame, do the display again. Note that x and y remains the same as before maximize and the dialog displays at the wrong position. width/height is correct though. ...

4. TextLayout getBounds().getX()    coderanch.com

5. MouseEvent.getX()/getY() Returning Negative Value    coderanch.com

I found that the MouseEvent.getX()/getY() could sometimes return negative value (-1 but very close to 0) for a mouse_moved event when I move the mouse to the top left hand corner. But isn't 0 the leftest that the mouse could move on a Component? Further mouse move should simply means the event generated to the background container, never to this component. ...