-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.1.5
-
x86
-
windows_95
Name: mf23781 Date: 03/19/98
import java.awt.event.*;
import java.awt.*;
import java.util.*;
import com.sun.java.swing.*;
import com.sun.java.swing.event.*;
import com.sun.java.swing.table.*;
/**
Recreate JOptionPane problems.<br>
1.Title not updated.
<br>
2.Size not correct.
**/
public class Test2 extends JPanel
{
static JFrame frame;
/**
Ctor.
**/
public Test2 ()
throws Exception
{
JButton shorty = new JButton("short");
add(shorty);
shorty.addActionListener( new ActionListener()
{
public void actionPerformed(ActionEvent ev)
{
JOptionPane.showMessageDialog(frame, // parent
"Short message", // message
"Short title", // title
JOptionPane.INFORMATION_MESSAGE ); // message type
}
}
);
JButton longy = new JButton("long");
add(longy);
longy.addActionListener( new ActionListener()
{
public void actionPerformed(ActionEvent ev)
{
JOptionPane.showMessageDialog(frame, // parent
"This is a long message that will get truncated because it does not fit.", // message
"Long title", // title
JOptionPane.INFORMATION_MESSAGE ); // message type
}
}
);
}
/**
MAIN
**/
public static void main(String args[])
throws Exception
{
WindowListener l = new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
};
frame = new JFrame ("Test Visual");
frame.addWindowListener(l);
frame.getContentPane().setLayout(new BorderLayout());
Test2 gui = new Test2();
frame.getContentPane().add("Center", gui);
frame.setSize(800, 600);
frame.pack();
frame.setVisible(true);
}
}
If you run the test case above and click on the "short" button and
then "long" then you should clearly see that the title of the dialog
remains unchanged.
This test case was designed to show a problem with the dialog itself
not being resized but this could not be reproduced here.
======================================================================
- duplicates
-
JDK-4120856 win32: setTitle on modal dialogs will fail to change the title
-
- Closed
-