//1 great tip to make JOptionPane resizable
//put HierarchyListener on the component that will be used as the message for the JOptionPane
myPanel.addHierarchyListener(new HierarchyListener() {
public void hierarchyChanged(HierarchyEvent e) {
//when the hierarchy changes get the ancestor for the message
Window window = SwingUtilities.getWindowAncestor(myPanel);
//check to see if the ancestor is an instance of Dialog and isn't resizable
if (window instanceof Dialog) {
Dialog dialog = (Dialog)window;
if (!dialog.isResizable()) {
//set resizable to true
dialog.setResizable(true);
}
}
}
});
Comments
Post a Comment