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

JInternalFrame.setIcon(true) before JDesktopPane.add(JIF) causes wrong state

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b105
    • CPU:
      x86
    • OS:
      windows_xp

      Description

      Name: jk109818 Date: 10/28/2002


      FULL PRODUCT VERSION :
      java version "1.4.0_02"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_02-b02)
      Java HotSpot(TM) Client VM (build 1.4.0_02-b02, mixed mode)

      AND

      java version "1.4.1_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
      Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)

      FULL OPERATING SYSTEM VERSION :

      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      When an JInternalFrame is iconified before being added to
      a JDesktopPane, it shows up as a regular (= un-iconified)
      JInternalFrame, but with a restore and a maximize button.

      Please note that adding before setting is not always
      possible, for instance when reading it from an XML file
      using XMLDecoder.

      Maximizing it before adding also gives unwanted results, I
      will submit that as a seperate bug.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. run JIFTest (see code)
      2. click Frame -> New
      3. every second JIF should appear iconified

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      As I said, every second JIF should be appearing minimized,
      but turns up as a regular sized JIF with a restore and a
      maximize button.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package test;

      import javax.swing.*;
      import java.awt.event.*;
      import java.awt.*;
      import java.beans.*;

      public class JIFTest extends javax.swing.JFrame {

      JDesktopPane desktop;
      int frameCount = 0;
      int x = 30;
      int y = 10;

      public JIFTest() {
      super("JInternalFrameTest");

      int inset = 50;
      Dimension screenSize = Toolkit.getDefaultToolkit
      ().getScreenSize();
      setBounds(inset, inset, screenSize.width - inset*2,
      screenSize.height-inset*2);

      addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {
      System.exit(0);
      }
      });

      desktop = new JDesktopPane();
      desktop.putClientProperty("JDesktopPane.dragMode", "outline");
      setContentPane(desktop);
      setJMenuBar(createMenuBar());
      }

      protected JMenuBar createMenuBar() {
      JMenuBar menuBar = new JMenuBar();

      JMenu menuFrame = new JMenu("Frame");
      menuFrame.setMnemonic(KeyEvent.VK_F);

      JMenuItem menuItemNew = new JMenuItem("New");
      menuItemNew.setMnemonic(KeyEvent.VK_N);
      menuItemNew.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
      createFrame();
      }
      });

      menuFrame.add(menuItemNew);
      menuBar.add(menuFrame);

      return menuBar;
      }

      protected void createFrame() {
      JInternalFrame frame = new JInternalFrame("Frame #" +
      ++frameCount,true,true,true,true);
      frame.setSize(300,300);
      frame.setLocation(x*frameCount, y*frameCount);
      frame.setVisible(true);
      try {
      frame.setIcon(frameCount % 2 == 0);
      System.out.println("frame(" + new Integer
      (frameCount).toString() + ").isIcon: " + frame.isIcon());
      } catch(PropertyVetoException e) {
      System.out.println("Exception caught");
      }
      desktop.add(frame);
      try {
      frame.setSelected(true);
      } catch(java.beans.PropertyVetoException e) {}
      }
      public static void main(String[] args) {
      JIFTest f = new JIFTest();
      f.setVisible(true);
      }
      }
      ---------- END SOURCE ----------

      CUSTOMER WORKAROUND :
      Iconifying the JIF after adding it to the JDesktopPane.

      Please not that this is not always possible.
      (Review ID: 166232)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              rchamyal Rajeev Chamyal (Inactive)
              Reporter:
              jkimsunw Jeffrey Kim (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: