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

Frame with DefaultLookAndFeelDecorated hinders hidden taskbar

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version "1.6.0_01"
      Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
      Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      If the Windows taskbar is set to auto-hide, a JFrame with setDefaultLookAndFeelDecorated as true and a sized to the screen height (not maximized) will disallow the taskbar from becoming visible.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Ensure your Windows taskbar is set to auto-hide.
      Create a JFrame, call setDefaultLookAndFeelDecorated(true), and set the size of the frame to the size of the screen.
      Display the frame and move your mouse to the Windows taskbar.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The Windows taskbar should appear.
      ACTUAL -
      The Windows taskbar does not appear. If I comment out the call to setDefaultLookAndFeelDecorated(true), and move my mouse to the taskbar then the taskbar does appear.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      The following code will keep the hidden taskbar from displaying:

      import java.awt.GraphicsEnvironment;
      import java.awt.Rectangle;

      import javax.swing.JFrame;
      import javax.swing.SwingUtilities;

      public final class TestFrame extends JFrame
      {
        public TestFrame() {
          super("Taskbar Test");

          GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
          Rectangle screenBounds = env.getMaximumWindowBounds();
          this.setBounds(0, 0, screenBounds.width, screenBounds.height);
        }

        public static void main(String[] args) {
          JFrame.setDefaultLookAndFeelDecorated(true);

          try {
            SwingUtilities.invokeLater(new Runnable() {
              public void run() {
                (new TestFrame()).setVisible(true);
              }
            });
          }
          catch (Throwable t) {
            t.printStackTrace();
            System.exit(-1);
          }
        }
      }




      The following code will allow the taskbar to display (JFrame.setDefaultLookAndFeelDecorated(true) is commented out):

      import java.awt.GraphicsEnvironment;
      import java.awt.Rectangle;

      import javax.swing.JFrame;
      import javax.swing.SwingUtilities;

      public final class TestFrame extends JFrame
      {
        public TestFrame() {
          super("Taskbar Test");

          GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
          Rectangle screenBounds = env.getMaximumWindowBounds();
          this.setBounds(0, 0, screenBounds.width, screenBounds.height);
        }

        public static void main(String[] args) {
      // JFrame.setDefaultLookAndFeelDecorated(true);

          try {
            SwingUtilities.invokeLater(new Runnable() {
              public void run() {
                (new TestFrame()).setVisible(true);
              }
            });
          }
          catch (Throwable t) {
            t.printStackTrace();
            System.exit(-1);
          }
        }
      }




      The following code also will allow the taskbar to display (frame height is set to screen height - 1):
      import java.awt.GraphicsEnvironment;
      import java.awt.Rectangle;

      import javax.swing.JFrame;
      import javax.swing.SwingUtilities;

      public final class TestFrame extends JFrame
      {
        public TestFrame() {
          super("Taskbar Test");

          GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
          Rectangle screenBounds = env.getMaximumWindowBounds();
          this.setBounds(0, 0, screenBounds.width, screenBounds.height - 1);
        }

        public static void main(String[] args) {
          JFrame.setDefaultLookAndFeelDecorated(true);

          try {
            SwingUtilities.invokeLater(new Runnable() {
              public void run() {
                (new TestFrame()).setVisible(true);
              }
            });
          }
          catch (Throwable t) {
            t.printStackTrace();
            System.exit(-1);
          }
        }
      }
      ---------- END SOURCE ----------

            Unassigned Unassigned
            ryeung Roger Yeung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: