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

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


    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 1.3.0
    • Fix Version/s: 1.3.1
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
    • CPU:
    • OS:



        Name: skT88420 Date: 10/25/99

        There's been a regression from 1.2.2 where JOptionPane dialogs
        that are owned by a non-resizable JDialog will not have the
        correct frame icon. In 1.2.2 the JOptionPane dialog would
        inherit the correct frame icon regardless of whether the
        JDialog was resizable or not. In 1.3beta this only happens
        if the JDialog IS resizable.

        The following testcase will demonstrate the bug. Before
        running it you need to change the source file to specify
        the location of an image file that can be used for the frame
        icon. Alternatively you can just comment out the call to set
        the frame icon and you'll end up using the default Java coffee
        cup icon. Either way the bug can be seen. Here's the code:

        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) {

                final JDialog dlg1 = new JDialog(this, "A resizable JDialog", false);
                JButton b1 = new JButton("Click to open JOptionPane");
                b1.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        JOptionPane.showMessageDialog(dlg1, MSG1);

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

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

        (Review ID: 96926)


            Issue Links



                • Assignee:
                  ibdsunw Ibd Ibd (Inactive)
                  skonchad Sandeep Konchady
                • Votes:
                  0 Vote for this issue
                  0 Start watching this issue


                  • Created: