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

JOptionPane's owned by non-resizable JDialog's have wrong frame icon

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.4.2
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
      None
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_nt

      Description

      We had a developer complain that bugid 4284610 is still reproducible in Merlin.
      I tested on windows NT with 1.4.2 build 8, and reproduced the problem.
      The resizable JDialog inherits the frame icon of the parent. The non-resizable
      JDialog does not.

      The test below is taken from 4284610.

      In the test below, you need to supply an icon image. I used the icon at:
      /test/java/awt/Frame/FrameIconImage/icon.gif

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

      public class IconBug extends JFrame {
          private static final Image APP_ICON =
              new ImageIcon("d:/java/wve/src/images/SineWave.gif").getImage();

          private static final String MSG1 =
              "<html><font size=-1>" +
              "The frame icon should be the same as<p>" +
              "the main app window icon";

          private static final String MSG2 =
              "<html><font size=-1>" +
              "What kind of frame icon does this window have?<p>" +
              "In <b>1.2.2</b> it is the same as the main app window icon,<p>" +
              "but in <b><font color=red>1.3beta</font></b> it's the default "+
              "<i>Windows waving flag</i> icon!";

          public static void main(String[] args) {
              new IconBug();
          }

          public IconBug() {

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

              final JDialog dlg1 = new JDialog(this, "A resizable JDialog", false);
              dlg1.setResizable(true);
              JButton b1 = new JButton("Click to open JOptionPane");
              b1.addActionListener(new ActionListener() {
                  public void actionPerformed(ActionEvent e) {
                      JOptionPane.showMessageDialog(dlg1, MSG1);
                  }
              });
              dlg1.getContentPane().add(b1);
              dlg1.pack();
              dlg1.setLocation(200,200);

              final JDialog dlg2 = new JDialog(this, "A NON-resizable JDialog", false);
              dlg2.setResizable(false);
              JButton b2 = new JButton("Click to open JOptionPane");
              b2.addActionListener(new ActionListener() {
                  public void actionPerformed(ActionEvent e) {
                      JOptionPane.showMessageDialog(dlg2, MSG2);
                  }
              });
              dlg2.getContentPane().add(b2);
              dlg2.pack();
              dlg2.setLocation(300,300);

              JButton b = new JButton("Click here open the JDialogs");
              b.addActionListener(new ActionListener() {
                  public void actionPerformed(ActionEvent e) {
                      dlg1.setVisible(true);
                      dlg2.setVisible(true);
                  }
              });

              getContentPane().add(b);
              pack();
              setVisible(true);
          }
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                prssunw Prs Prs (Inactive)
                Reporter:
                ehawkessunw Eric Hawkes (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: