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

JFrame covers taskbar maximizing if setDefaultLookAndFeelDecorated and Metal L&F

XMLWordPrintable

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

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Versión 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      When trying to maximize a JFrame with setDefaultLookAndFeelDecorated(true) on Metal L&F, the frame covers up the taskbar on Windows.

      Target platforms tested: 1.5.0_07, 1.5.0_08, 1.6b96
      OS Platform: Microsoft Windows XP SP2, Classic theme (W2k)

      THE PROBLEM

      Creating a big application with several modules (frames) and each module with several options (frames). The user needs to work with several options at the same time. So using frames for the options is impossible, due to if the user opens four options from two modules, there will be seven frames opened and seven icons in the Windows taskbar (launcher + two modules + four options).

      To avoid creating too much icons in the taskbar, the options are created as internal frames of the modules, so the number of icons in the task bar is the number of opened modules + 1 (launcher). The problem is the look and feel of the entire application, because the frames and dialogs (modal dialogs for input data) have the native decoration (windows XP-2000) and the internal frames has the L&F decoration (Metal).

      The client require us to create a system with a consistent L&F across all the windows created, so mixing native with L&F decorations for frames/dialogs and internal frames is not acceptable. The solution is to use setDefaultLookAndFeelDecoration(true) on frames and dialogs, so all windows created have the same decoration.

      The problem is that when showing the JFrame maximized, this covers up the taskbar if use the Metal L&F. If Motif or Windows L&F is set, the frame shows maximized covering the entire screen except the taskbar. If Metal L&F is used, the frame shows maximized covering the entire screen, covering up the windows taskbar. This is not acceptable since the user needs to change from one module to another and normal users use to click on the taskbar to perform this operation. If we want to cover the taskbar when maximizing the frame like Internet Explorer fullscreen mode (F11), this should be selectable by code through any flag or method.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Execute the following code on MS Windows XP.
      Try separately with

      "javax.swing.plaf.metal.MetalLookAndFeel"
      "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"
      "com.sun.java.swing.plaf.motif.MotifLookAndFeel"

      and each L&F will show a different behavior.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      All provided L&F should have the same behavior, covering or not the taskbar. This behavior should be selectable by code.
      ACTUAL -
      JFrames with setDefaultLookAndFeelDecorated(true) and maximized covers up the taskbar on windows if Metal L&F is used. Motif and Windows L&F works fine.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;

      public class MyFrame extends JFrame {


      public MyFrame() {

      pack();
      setExtendedState(JFrame.MAXIMIZED_BOTH);
      setVisible(true);
      }

      public static void main(String[] args) {

      try {
      UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
      JFrame.setDefaultLookAndFeelDecorated(true);

      SwingUtilities.invokeLater(new Runnable() {
      public void run() {
      new MyFrame();
      }
      });
      } catch (Exception e) {
      }
      }
      }

      ---------- END SOURCE ----------

            shickeysunw Shannon Hickey (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: