Other | Other |
---|---|
1.3.1 ladybirdFixed | 1.4.0Fixed |
Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
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) { 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); } } (Review ID: 96926) ======================================================================
|