List of usage examples for javax.swing JTextArea addHierarchyListener
public void addHierarchyListener(HierarchyListener l)
From source file:org.wandora.application.gui.topicpanels.ProcessingTopicPanel.java
private void showRichErrorDialog(String msg) { final JTextArea area = new JTextArea(); area.setFont(errorMessageFont);//from w w w. ja v a2s .co m //area.setPreferredSize(new Dimension(520, 180)); area.setEditable(false); area.setText(msg); // Make the JOptionPane resizable using the HierarchyListener area.addHierarchyListener(new HierarchyListener() { public void hierarchyChanged(HierarchyEvent e) { Window window = SwingUtilities.getWindowAncestor(area); if (window instanceof Dialog) { Dialog dialog = (Dialog) window; if (!dialog.isResizable()) { dialog.setResizable(true); } } } }); JScrollPane scroller = new JScrollPane(area); scroller.setPreferredSize(new Dimension(520, 180)); JOptionPane.showMessageDialog(Wandora.getWandora(), scroller, "Errors", JOptionPane.PLAIN_MESSAGE); }