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

Frame's geometry includes the window's decorations

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      solaris_2.5

      Description

      [ dood 4/8/96 ]

      The size of a Frame seems to include the window decorations
      (ie, the title bar, resize handles, etc). Run the following program
      and you will see that the line drawn from (0, 0) to (width, height)
      actually gets painted from one corner of the Frame's outer
      decorations to the other.

      While this may be useful for some things, it makes it
      really difficult to position children, or paint into a Frame
      in such a way that you can ensure they won't be covered
      by the window decorations (especially since there is no
      interface to determine the size of the decorations which
      vary depending on the window system).

      //
      // FrameBug.java - illustrates that the size of a frame includes
      // the window decorations
      //
      import java.awt.*;

      public class FrameBug extends Frame {

          public void paint(Graphics g) {
      g.drawLine(0, 0, size().width, size().height);
          }

          public static void main(String args[]) {
              FrameBug f = new FrameBug();

      f.resize(500, 300);
      f.show();
          }
      }

        Attachments

          Activity

            People

            Assignee:
            amfowler Anne Fowler (Inactive)
            Reporter:
            duke J. Duke (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: