Resizable JOptionPane Code Snippet

//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

Popular posts from this blog

Getting Started: Quick Setup for GXT 3 (includes reset.css link how to)

How to setup GXT 3 examples, samples and demos

ExtJs4 : Dynamically Add Columns