Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-1251439

size().width after window resize on Windows returns wrong value if < min width

XMLWordPrintable

    • b01
    • generic
    • windows_95
    • Verified


        On the Windows platform, size().width returns an incorrect value
        if the size of the frame attempts to be resized smaller then the minimum
        allowable width. The size is actually reporting the "correct" value, yet
        if this value is less than the allowable threshold width, the window is
        automatically resized to that minimum (112 width under windows). However,
        size does not report that value.

        The following test case shows this incorrect behaviour.

        The first time the mouse enters, the window should be resized but is
        not, and size().width returns 112 which looks about correct. The second
        time through size().width incorrectly returns 10.

        here's the code:


        import java.awt.*;
        import java.applet.*;

        class testWindowBug extends Applet
        {
           Window testWin = new Window(null);

           public boolean mouseEnter(Event evt, int x, int y)
           {
              testWin.setBackground(Color.green);
              testWin.resize(10,15);
              testWin.show();
              System.out.println(testWin.size().width);
              return true;
           }

           public boolean mouseExit(Event evt, int x, int y)
           {
              testWin.hide();
              return true;
           }
        }

              tdv Dmitri Trembovetski (Inactive)
              rschiavisunw Richard Schiavi (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: