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

DesktopManager.deiconifyFrame() with GTK l/f throws IllegalArgumentException

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 6u10
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:

      Description

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


      ADDITIONAL OS VERSION INFORMATION :
      Linux csdpc20.arlut.utexas.edu 2.6.26.3-29.fc9.i686 #1 SMP Wed Sep 3 03:42:27 EDT 2008 i686 i686 i386 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      If DesktopManager.deiconifyFrame() is called on a JInternalFrame with the GTK look and feel enabled,
      bad behavior results. If the JInternalFrame was not previously iconified, an IllegalArgumentException
      is thrown, and the internal frame is made invisible. If the JInternalFrame is first iconified by calling setIcon(true) on the internal frame, the deiconfifyFrame() call does not throw an exception, but the internal frame is not rendered properly, and later attempts to iconify the frame will result in IllegalArgumentExceptions.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile and run the attached test code on Linux.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      A Frame should be displayed with a visible JInternalFrame within it.
      ACTUAL -
       If useGTK and useDeIconify are set to true, problems will result.

      The specific manifestation of the problem depends on the setting of the iconifyFirst variable.

      If iconifyFirst is set to false, an IllegalArgumentException will be thrown when deiconifyFrame() is called.

      If IconifyFirst is set to true, the JInternalFrame will be improperly rendered on screen, and clicking on the icon button at the bottom of the Frame will cause an IllegalArgumentException to be thrown.

      REPRODUCIBILITY :
      This bug can be reproduced always.

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

      public class bug_demo {

        static final boolean useGTK = true;
        static final iconifyFirst = true;
        static final useDeIconify = true;

        public static void main(String args[]) {

          if (useGTK)
            {
              try
                {
                  UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
                }
              catch (Exception ex)
                {
                  System.err.println("Problem loading GTK look and feel");
                  ex.printStackTrace();
                  System.exit(1);
                }
            }

          JFrame topFrame = new JFrame();
          JDesktopPane pane = new JDesktopPane();
          topFrame.add(pane);
          topFrame.setBounds(100,100,400,400);
          topFrame.setVisible(true);

          JInternalFrame internalFrame = new JInternalFrame("Test");
          pane.add(internalFrame);
          internalFrame.setBounds(50,50,200,200);
          internalFrame.setVisible(true);

          if (iconifyFirst)
            {
              try
                {
                  internalFrame.setIcon(true);
                }
              catch (Exception ex)
                {
                }
            }

          if (useDeIconify)
            {
              pane.getDesktopManager().deiconifyFrame(internalFrame);
            }
          else
            {
              try
                {
                  internalFrame.setIcon(false);
                }
              catch (Exception ex)
                {
                }
            }
        }
      }


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

      CUSTOMER SUBMITTED WORKAROUND :
      Never use DesktopManager.deiconifyFrame() in conjunction with the GTK look and feel.

      JInternalFrame.setIcon(false) does seem to work as an alternative, but DesktopManager.deiconifyFrame() is a death trap.

        Attachments

          Activity

            People

            • Assignee:
              peterz Peter Zhelezniakov (Inactive)
              Reporter:
              ndcosta Nelson Dcosta
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported:
                Indexed: