Other | Other |
---|---|
1.1.6 1.1.6Fixed | 1.2.0Fixed |
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Relates :
|
Frame.getBounds() returns the wrong position after a resize, when the resize changes the upper left corner of the frame. // Test3.java: import java.awt.*; import java.awt.event.*; public class Test3 extends Frame { Window w; public Test3() { final Frame f = this; Panel p = new Panel(); f.add(p); p.setLayout(new BorderLayout()); Button b = new Button("Press"); b.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent be){ Component c = (Component)be.getSource(); Point cp = c.getLocationOnScreen(); System.out.println("Screen Position = " + cp.x + " " + cp.y); System.out.println("Window bounds = " + f.getBounds()); } }); p.add("Center", b); } public static void main(String args[]) { Test3 g = new Test3(); g.pack(); g.setVisible(true); } }
|