JDK-4103095 : Frame.getBounds() returns the wrong position after a resize.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: solaris_2.6,1.1.4,1.1.5,1.1.6,1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_2.5.1,solaris_2.6
  • CPU: generic,sparc
  • Submitted: 1998-01-09
  • Updated: 1998-08-14
  • Resolved: 1998-08-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other Other
1.1.6 1.1.6Fixed 1.2.0Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Description
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);
    }

}

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: 1.2beta3 generic FIXED IN: 1.1.6 1.2beta3 INTEGRATED IN: 1.1.6 1.2beta3 VERIFIED IN: 1.1.6
14-06-2004

EVALUATION The frame's new (x,y) position needs to be computed and set in src/solaris/sun/awt_Frame.c, outerCanvasResizeCB. mike.bronson@eng 1998-01-09
09-01-1998