1:
37:
38:
39: package ;
40:
41: import ;
42: import ;
43: import ;
44: import ;
45: import ;
46: import ;
47: import ;
48: import ;
49: import ;
50: import ;
51: import ;
52: import ;
53: import ;
54: import ;
55: import ;
56: import ;
57: import ;
58:
59: import ;
60: import ;
61: import ;
62: import ;
63: import ;
64: import ;
65: import ;
66: import ;
67: import ;
68: import ;
69: import ;
70: import ;
71: import ;
72: import ;
73: import ;
74: import ;
75: import ;
76: import ;
77: import ;
78: import ;
79:
80:
83: public class BasicOptionPaneUI extends OptionPaneUI
84: {
85:
93: public class ButtonActionListener implements ActionListener
94: {
95:
96: protected int buttonIndex;
97:
98:
103: public ButtonActionListener(int buttonIndex)
104: {
105: this.buttonIndex = buttonIndex;
106: }
107:
108:
113: public void actionPerformed(ActionEvent e)
114: {
115: Object value = new Integer(JOptionPane.CLOSED_OPTION);
116: Object[] options = optionPane.getOptions();
117: if (options != null)
118: value = new Integer(buttonIndex);
119: else
120: {
121: String text = ((JButton) e.getSource()).getText();
122: if (text.equals(OK_STRING))
123: value = new Integer(JOptionPane.OK_OPTION);
124: if (text.equals(CANCEL_STRING))
125: value = new Integer(JOptionPane.CANCEL_OPTION);
126: if (text.equals(YES_STRING))
127: value = new Integer(JOptionPane.YES_OPTION);
128: if (text.equals(NO_STRING))
129: value = new Integer(JOptionPane.NO_OPTION);
130: }
131: optionPane.setValue(value);
132: resetInputValue();
133:
134: Window owner = SwingUtilities.windowForComponent(optionPane);
135:
136: if (owner instanceof JDialog)
137: ((JDialog) owner).dispose();
138:
139:
140: JInternalFrame inf = (JInternalFrame) SwingUtilities.getAncestorOfClass(JInternalFrame.class,
141: optionPane);
142: if (inf != null)
143: {
144: try
145: {
146: inf.setClosed(true);
147: }
148: catch (PropertyVetoException pve)
149: {
150: }
151: }
152: }
153: }
154:
155:
164: public static class ButtonAreaLayout implements LayoutManager
165: {
166:
167: protected boolean centersChildren = true;
168:
169:
170: protected int padding;
171:
172:
173: protected boolean syncAllWidths;
174:
175:
176: private transient int widthOfWidestButton;
177:
178:
179: private transient int tallestButton;
180:
181:
188: public ButtonAreaLayout(boolean syncAllWidths, int padding)
189: {
190: this.syncAllWidths = syncAllWidths;
191: this.padding = padding;
192: }
193:
194:
200: public void addLayoutComponent(String string, Component comp)
201: {
202:
203: }
204:
205:
210: public boolean getCentersChildren()
211: {
212: return centersChildren;
213: }
214:
215:
220: public int getPadding()
221: {
222: return padding;
223: }
224:
225:
231: public boolean getSyncAllWidths()
232: {
233: return syncAllWidths;
234: }
235:
236:
241: public void layoutContainer(Container container)
242: {
243: Component[] buttonList = container.getComponents();
244: int x = container.getInsets().left;
245: if (getCentersChildren())
246: x += (int) ((double) (container.getSize().width) / 2
247: - (double) (buttonRowLength(container)) / 2);
248: for (int i = 0; i < buttonList.length; i++)
249: {
250: Dimension dims = buttonList[i].getPreferredSize();
251: if (syncAllWidths)
252: {
253: buttonList[i].setBounds(x, 0, widthOfWidestButton, dims.height);
254: x += widthOfWidestButton + getPadding();
255: }
256: else
257: {
258: buttonList[i].setBounds(x, 0, dims.width, dims.height);
259: x += dims.width + getPadding();
260: }
261: }
262: }
263:
264:
272: private int buttonRowLength(Container c)
273: {
274: Component[] buttonList = c.getComponents();
275:
276: int buttonLength = 0;
277: int widest = 0;
278: int tallest = 0;
279:
280: for (int i = 0; i < buttonList.length; i++)
281: {
282: Dimension dims = buttonList[i].getPreferredSize();
283: buttonLength += dims.width + getPadding();
284: widest = Math.max(widest, dims.width);
285: tallest = Math.max(tallest, dims.height);
286: }
287:
288: widthOfWidestButton = widest;
289: tallestButton = tallest;
290:
291: int width;
292: if (getSyncAllWidths())
293: width = widest * buttonList.length
294: + getPadding() * (buttonList.length - 1);
295: else
296: width = buttonLength;
297:
298: Insets insets = c.getInsets();
299: width += insets.left + insets.right;
300:
301: return width;
302: }
303:
304:
311: public Dimension minimumLayoutSize(Container c)
312: {
313: return preferredLayoutSize(c);
314: }
315:
316:
323: public Dimension preferredLayoutSize(Container c)
324: {
325: int w = buttonRowLength(c);
326:
327: return new Dimension(w, tallestButton);
328: }
329:
330:
336: public void removeLayoutComponent(Component c)
337: {
338:
339: }
340:
341:
346: public void setCentersChildren(boolean newValue)
347: {
348: centersChildren = newValue;
349: }
350:
351:
356: public void setPadding(int newPadding)
357: {
358: padding = newPadding;
359: }
360:
361:
366: public void setSyncAllWidths(boolean newValue)
367: {
368: syncAllWidths = newValue;
369: }
370: }
371:
372:
379: public class PropertyChangeHandler implements PropertyChangeListener
380: {
381:
387: public void propertyChange(PropertyChangeEvent e)
388: {
389: if (e.getPropertyName().equals(JOptionPane.ICON_PROPERTY)
390: || e.getPropertyName().equals(JOptionPane.MESSAGE_TYPE_PROPERTY))
391: addIcon(messageAreaContainer);
392: else if (e.getPropertyName().equals(JOptionPane.INITIAL_SELECTION_VALUE_PROPERTY))
393: resetSelectedValue();
394: else if (e.getPropertyName().equals(JOptionPane.INITIAL_VALUE_PROPERTY)
395: || e.getPropertyName().equals(JOptionPane.OPTIONS_PROPERTY)
396: || e.getPropertyName().equals(JOptionPane.OPTION_TYPE_PROPERTY))
397: {
398: Container newButtons = createButtonArea();
399: optionPane.remove(buttonContainer);
400: optionPane.add(newButtons);
401: buttonContainer = newButtons;
402: }
403:
404: else if (e.getPropertyName().equals(JOptionPane.MESSAGE_PROPERTY)
405: || e.getPropertyName().equals(JOptionPane.WANTS_INPUT_PROPERTY)
406: || e.getPropertyName().equals(JOptionPane.SELECTION_VALUES_PROPERTY))
407: {
408: optionPane.removeAll();
409: messageAreaContainer = createMessageArea();
410: optionPane.add(messageAreaContainer);
411: optionPane.add(buttonContainer);
412: }
413: optionPane.invalidate();
414: optionPane.repaint();
415: }
416: }
417:
418:
419: protected boolean hasCustomComponents = false;
420:
421:
422:
423:
424:
425:
426:
431: protected Component initialFocusComponent;
432:
433:
434: protected JComponent inputComponent;
435:
436:
437: public static int minimumHeight;
438:
439:
440: public static int minimumWidth;
441:
442:
443: protected Dimension minimumSize;
444:
445:
446: protected PropertyChangeListener propertyChangeListener;
447:
448:
449: protected JOptionPane optionPane;
450:
451:
452:
453: private static final int iconSize = 36;
454:
455:
456: private transient Color messageForeground;
457:
458:
459: private transient Border messageBorder;
460:
461:
462: private transient Border buttonBorder;
463:
464:
465: private static final String OK_STRING = "OK";
466:
467:
468: private static final String YES_STRING = "Yes";
469:
470:
471: private static final String NO_STRING = "No";
472:
473:
474: private static final String CANCEL_STRING = "Cancel";
475:
476:
478: transient Container messageAreaContainer;
479:
480:
482: transient Container buttonContainer;
483:
484:
488: private static class MessageIcon implements Icon
489: {
490:
495: public int getIconWidth()
496: {
497: return iconSize;
498: }
499:
500:
505: public int getIconHeight()
506: {
507: return iconSize;
508: }
509:
510:
519: public void paintIcon(Component c, Graphics g, int x, int y)
520: {
521: }
522: }
523:
524:
525: private static MessageIcon errorIcon = new MessageIcon()
526: {
527: public void paintIcon(Component c, Graphics g, int x, int y)
528: {
529: Polygon oct = new Polygon(new int[] { 0, 0, 9, 27, 36, 36, 27, 9 },
530: new int[] { 9, 27, 36, 36, 27, 9, 0, 0 }, 8);
531: g.translate(x, y);
532:
533: Color saved = g.getColor();
534: g.setColor(Color.RED);
535:
536: g.fillPolygon(oct);
537:
538: g.setColor(Color.BLACK);
539: g.drawRect(13, 16, 10, 4);
540:
541: g.setColor(saved);
542: g.translate(-x, -y);
543: }
544: };
545:
546:
547: private static MessageIcon infoIcon = new MessageIcon()
548: {
549: public void paintIcon(Component c, Graphics g, int x, int y)
550: {
551: g.translate(x, y);
552: Color saved = g.getColor();
553:
554:
555: g.setColor(Color.RED);
556:
557: g.fillOval(0, 0, iconSize, iconSize);
558:
559: g.setColor(Color.BLACK);
560: g.drawOval(16, 6, 4, 4);
561:
562: Polygon bottomI = new Polygon(new int[] { 15, 15, 13, 13, 23, 23, 21, 21 },
563: new int[] { 12, 28, 28, 30, 30, 28, 28, 12 },
564: 8);
565: g.drawPolygon(bottomI);
566:
567: g.setColor(saved);
568: g.translate(-x, -y);
569: }
570: };
571:
572:
573: private static MessageIcon warningIcon = new MessageIcon()
574: {
575: public void paintIcon(Component c, Graphics g, int x, int y)
576: {
577: g.translate(x, y);
578: Color saved = g.getColor();
579: g.setColor(Color.YELLOW);
580:
581: Polygon triangle = new Polygon(new int[] { 0, 18, 36 },
582: new int[] { 36, 0, 36 }, 3);
583: g.fillPolygon(triangle);
584:
585: g.setColor(Color.BLACK);
586:
587: Polygon excl = new Polygon(new int[] { 15, 16, 20, 21 },
588: new int[] { 8, 26, 26, 8 }, 4);
589: g.drawPolygon(excl);
590: g.drawOval(16, 30, 4, 4);
591:
592: g.setColor(saved);
593: g.translate(-x, -y);
594: }
595: };
596:
597:
598: private static MessageIcon questionIcon = new MessageIcon()
599: {
600: public void paintIcon(Component c, Graphics g, int x, int y)
601: {
602: g.translate(x, y);
603: Color saved = g.getColor();
604: g.setColor(Color.GREEN);
605:
606: g.fillRect(0, 0, iconSize, iconSize);
607:
608: g.setColor(Color.BLACK);
609:
610: g.drawOval(11, 2, 16, 16);
611: g.drawOval(14, 5, 10, 10);
612:
613: g.setColor(Color.GREEN);
614: g.fillRect(0, 10, iconSize, iconSize - 10);
615:
616: g.setColor(Color.BLACK);
617:
618: g.drawLine(11, 10, 14, 10);
619:
620: g.drawLine(24, 10, 17, 22);
621: g.drawLine(27, 10, 20, 22);
622: g.drawLine(17, 22, 20, 22);
623:
624: g.drawOval(17, 25, 3, 3);
625:
626: g.setColor(saved);
627: g.translate(-x, -y);
628: }
629: };
630:
631:
632:
633:
634:
635:
638: public BasicOptionPaneUI()
639: {
640: }
641:
642:
653: protected void addButtonComponents(Container container, Object[] buttons,
654: int initialIndex)
655: {
656: if (buttons == null)
657: return;
658: for (int i = 0; i < buttons.length; i++)
659: {
660: if (buttons[i] != null)
661: {
662: Component toAdd;
663: if (buttons[i] instanceof Component)
664: toAdd = (Component) buttons[i];
665: else
666: {
667: if (buttons[i] instanceof Icon)
668: toAdd = new JButton((Icon) buttons[i]);
669: else
670: toAdd = new JButton(buttons[i].toString());
671: hasCustomComponents = true;
672: }
673: if (toAdd instanceof JButton)
674: ((JButton) toAdd).addActionListener(createButtonActionListener(i));
675: if (i == initialIndex)
676: initialFocusComponent = toAdd;
677: container.add(toAdd);
678: }
679: }
680: selectInitialValue(optionPane);
681: }
682:
683:
688: protected void addIcon(Container top)
689: {
690: JLabel iconLabel = null;
691: Icon icon = getIcon();
692: if (icon != null)
693: {
694: iconLabel = new JLabel(icon);
695: top.add(iconLabel, BorderLayout.WEST);
696: }
697: }
698:
699:
705: private static GridBagConstraints createConstraints()
706: {
707: GridBagConstraints constraints = new GridBagConstraints();
708: constraints.gridx = GridBagConstraints.REMAINDER;
709: constraints.gridy = GridBagConstraints.REMAINDER;
710: constraints.gridwidth = 0;
711: constraints.anchor = GridBagConstraints.LINE_START;
712: constraints.fill = GridBagConstraints.NONE;
713: constraints.insets = new Insets(0, 0, 3, 0);
714:
715: return constraints;
716: }
717:
718:
734: protected void addMessageComponents(Container container,
735: GridBagConstraints cons, Object msg,
736: int maxll, boolean internallyCreated)
737: {
738: if (msg == null)
739: return;
740: hasCustomComponents = internallyCreated;
741: if (msg instanceof Object[])
742: {
743: Object[] arr = (Object[]) msg;
744: for (int i = 0; i < arr.length; i++)
745: addMessageComponents(container, cons, arr[i], maxll,
746: internallyCreated);
747: return;
748: }
749: else if (msg instanceof Component)
750: {
751: container.add((Component) msg, cons);
752: cons.gridy++;
753: }
754: else if (msg instanceof Icon)
755: {
756: container.add(new JLabel((Icon) msg), cons);
757: cons.gridy++;
758: }
759: else
760: {
761:
762:
763:
764:
765:
766: if (msg.toString().length() > maxll)
767: {
768: Box tmp = new Box(BoxLayout.Y_AXIS);
769: burstStringInto(tmp, msg.toString(), maxll);
770: addMessageComponents(container, cons, tmp, maxll, true);
771: }
772: else
773: addMessageComponents(container, cons, new JLabel(msg.toString()),
774: maxll, true);
775: }
776: }
777:
778:
786: protected void burstStringInto(Container c, String d, int maxll)
787: {
788:
789:
790:
791:
792:
793:
794:
795: if (d == null || c == null)
796: return;
797: JLabel label = new JLabel(d);
798: c.add(label);
799: }
800:
801:
809: public boolean containsCustomComponents(JOptionPane op)
810: {
811: return hasCustomComponents;
812: }
813:
814:
821: protected ActionListener createButtonActionListener(int buttonIndex)
822: {
823: return new ButtonActionListener(buttonIndex);
824: }
825:
826:
831: protected Container createButtonArea()
832: {
833: JPanel buttonPanel = new JPanel();
834:
835: buttonPanel.setLayout(createLayoutManager());
836: addButtonComponents(buttonPanel, getButtons(), getInitialValueIndex());
837:
838: return buttonPanel;
839: }
840:
841:
846: protected LayoutManager createLayoutManager()
847: {
848: return new ButtonAreaLayout(getSizeButtonsToSameWidth(), 6);
849: }
850:
851:
856: protected Container createMessageArea()
857: {
858: JPanel messageArea = new JPanel();
859: messageArea.setLayout(new BorderLayout());
860: addIcon(messageArea);
861:
862: JPanel rightSide = new JPanel();
863: rightSide.setBorder(BorderFactory.createEmptyBorder(0, 11, 17, 0));
864: rightSide.setLayout(new GridBagLayout());
865: GridBagConstraints con = createConstraints();
866:
867: addMessageComponents(rightSide, con, getMessage(),
868: getMaxCharactersPerLineCount(), false);
869:
870: if (optionPane.getWantsInput())
871: {
872: Object[] selection = optionPane.getSelectionValues();
873:
874: if (selection == null)
875: inputComponent = new JTextField(15);
876: else if (selection.length < 20)
877: inputComponent = new JComboBox(selection);
878: else
879: inputComponent = new JList(selection);
880: if (inputComponent != null)
881: {
882: addMessageComponents(rightSide, con, inputComponent,
883: getMaxCharactersPerLineCount(), false);
884: resetSelectedValue();
885: selectInitialValue(optionPane);
886: }
887: }
888:
889: messageArea.add(rightSide, BorderLayout.EAST);
890:
891: return messageArea;
892: }
893:
894:
900: protected PropertyChangeListener createPropertyChangeListener()
901: {
902: return new PropertyChangeHandler();
903: }
904:
905:
911: protected Container createSeparator()
912: {
913:
914:
915: return null;
916: }
917:
918:
925: public static ComponentUI createUI(JComponent x)
926: {
927: return new BasicOptionPaneUI();
928: }
929:
930:
936: protected Object[] getButtons()
937: {
938: if (optionPane.getOptions() != null)
939: return optionPane.getOptions();
940: switch (optionPane.getOptionType())
941: {
942: case JOptionPane.YES_NO_OPTION:
943: return new Object[] { YES_STRING, NO_STRING };
944: case JOptionPane.YES_NO_CANCEL_OPTION:
945: return new Object[] { YES_STRING, NO_STRING, CANCEL_STRING };
946: case JOptionPane.OK_CANCEL_OPTION:
947: case JOptionPane.DEFAULT_OPTION:
948: return new Object[] { OK_STRING, CANCEL_STRING };
949: }
950: return null;
951: }
952:
953:
959: protected Icon getIcon()
960: {
961: if (optionPane.getIcon() != null)
962: return optionPane.getIcon();
963: else
964: return getIconForType(optionPane.getMessageType());
965: }
966:
967:
974: protected Icon getIconForType(int messageType)
975: {
976: Icon tmp = null;
977: switch (messageType)
978: {
979: case JOptionPane.ERROR_MESSAGE:
980: tmp = errorIcon;
981: break;
982: case JOptionPane.INFORMATION_MESSAGE:
983: tmp = infoIcon;
984: break;
985: case JOptionPane.WARNING_MESSAGE:
986: tmp = warningIcon;
987: break;
988: case JOptionPane.QUESTION_MESSAGE:
989: tmp = questionIcon;
990: break;
991: }
992: return tmp;
993:
994:
995: }
996:
997:
1002: protected int getInitialValueIndex()
1003: {
1004: Object[] buttons = getButtons();
1005:
1006: if (buttons == null)
1007: return -1;
1008:
1009: Object select = optionPane.getInitialValue();
1010:
1011: for (int i = 0; i < buttons.length; i++)
1012: {
1013: if (select == buttons[i])
1014: return i;
1015: }
1016: return 0;
1017: }
1018:
1019:
1026: protected int getMaxCharactersPerLineCount()
1027: {
1028: return optionPane.getMaxCharactersPerLineCount();
1029: }
1030:
1031:
1038: public Dimension getMaximumSize(JComponent c)
1039: {
1040: return getPreferredSize(c);
1041: }
1042:
1043:
1048: protected Object getMessage()
1049: {
1050: return optionPane.getMessage();
1051: }
1052:
1053:
1058: public Dimension getMinimumOptionPaneSize()
1059: {
1060: return minimumSize;
1061: }
1062:
1063:
1070: public Dimension getMinimumSize(JComponent c)
1071: {
1072: return getPreferredSize(c);
1073: }
1074:
1075:
1084: public Dimension getPreferredSize(JComponent c)
1085: {
1086: Dimension d = optionPane.getLayout().preferredLayoutSize(optionPane);
1087: Dimension d2 = getMinimumOptionPaneSize();
1088:
1089: int w = Math.max(d.width, d2.width);
1090: int h = Math.max(d.height, d2.height);
1091: return new Dimension(w, h);
1092: }
1093:
1094:
1099: protected boolean getSizeButtonsToSameWidth()
1100: {
1101: return true;
1102: }
1103:
1104:
1107: protected void installComponents()
1108: {
1109:
1110: hasCustomComponents = false;
1111: Container msg = createMessageArea();
1112: if (msg != null)
1113: {
1114: ((JComponent) msg).setBorder(messageBorder);
1115: msg.setForeground(messageForeground);
1116: messageAreaContainer = msg;
1117: optionPane.add(msg);
1118: }
1119:
1120:
1121:
1122:
1123:
1124: Container sep = createSeparator();
1125: if (sep != null)
1126: optionPane.add(sep);
1127:
1128: Container button = createButtonArea();
1129: if (button != null)
1130: {
1131: ((JComponent) button).setBorder(buttonBorder);
1132: buttonContainer = button;
1133: optionPane.add(button);
1134: }
1135:
1136: optionPane.setBorder(BorderFactory.createEmptyBorder(12, 12, 11, 11));
1137: optionPane.invalidate();
1138: }
1139:
1140:
1143: protected void installDefaults()
1144: {
1145: UIDefaults defaults = UIManager.getLookAndFeelDefaults();
1146:
1147: optionPane.setFont(defaults.getFont("OptionPane.font"));
1148: optionPane.setBackground(defaults.getColor("OptionPane.background"));
1149: optionPane.setForeground(defaults.getColor("OptionPane.foreground"));
1150: optionPane.setBorder(defaults.getBorder("OptionPane.border"));
1151: optionPane.setOpaque(true);
1152:
1153: messageBorder = defaults.getBorder("OptionPane.messageAreaBorder");
1154: messageForeground = defaults.getColor("OptionPane.messageForeground");
1155: buttonBorder = defaults.getBorder("OptionPane.buttonAreaBorder");
1156:
1157: minimumSize = defaults.getDimension("OptionPane.minimumSize");
1158: minimumWidth = minimumSize.width;
1159: minimumHeight = minimumSize.height;
1160:
1161:
1162:
1163:
1164:
1170: }
1171:
1172:
1175: protected void installKeyboardActions()
1176: {
1177:
1178: }
1179:
1180:
1183: protected void installListeners()
1184: {
1185: propertyChangeListener = createPropertyChangeListener();
1186:
1187: optionPane.addPropertyChangeListener(propertyChangeListener);
1188: }
1189:
1190:
1195: public void installUI(JComponent c)
1196: {
1197: if (c instanceof JOptionPane)
1198: {
1199: optionPane = (JOptionPane) c;
1200:
1201: installDefaults();
1202: installComponents();
1203: installListeners();
1204: installKeyboardActions();
1205: }
1206: }
1207:
1208:
1212: protected void resetInputValue()
1213: {
1214: if (optionPane.getWantsInput() && inputComponent != null)
1215: {
1216: Object output = null;
1217: if (inputComponent instanceof JTextField)
1218: output = ((JTextField) inputComponent).getText();
1219: else if (inputComponent instanceof JComboBox)
1220: output = ((JComboBox) inputComponent).getSelectedItem();
1221: else if (inputComponent instanceof JList)
1222: output = ((JList) inputComponent).getSelectedValue();
1223:
1224: if (output != null)
1225: optionPane.setInputValue(output);
1226: }
1227: }
1228:
1229:
1235: public void selectInitialValue(JOptionPane op)
1236: {
1237: if (inputComponent != null)
1238: {
1239: inputComponent.requestFocus();
1240: return;
1241: }
1242: if (initialFocusComponent != null)
1243: initialFocusComponent.requestFocus();
1244: }
1245:
1246:
1251: void resetSelectedValue()
1252: {
1253: if (inputComponent != null)
1254: {
1255: Object init = optionPane.getInitialSelectionValue();
1256: if (init == null)
1257: return;
1258: if (inputComponent instanceof JTextField)
1259: ((JTextField) inputComponent).setText((String) init);
1260: else if (inputComponent instanceof JComboBox)
1261: ((JComboBox) inputComponent).setSelectedItem(init);
1262: else if (inputComponent instanceof JList)
1263: {
1264:
1265: }
1266: }
1267: }
1268:
1269:
1272: protected void uninstallComponents()
1273: {
1274: optionPane.removeAll();
1275: buttonContainer = null;
1276: messageAreaContainer = null;
1277: }
1278:
1279:
1282: protected void uninstallDefaults()
1283: {
1284: optionPane.setFont(null);
1285: optionPane.setForeground(null);
1286: optionPane.setBackground(null);
1287:
1288: minimumSize = null;
1289:
1290: messageBorder = null;
1291: buttonBorder = null;
1292: messageForeground = null;
1293:
1294:
1295:
1296:
1302: }
1303:
1304:
1307: protected void uninstallKeyboardActions()
1308: {
1309:
1310: }
1311:
1312:
1315: protected void uninstallListeners()
1316: {
1317: optionPane.removePropertyChangeListener(propertyChangeListener);
1318: propertyChangeListener = null;
1319: }
1320:
1321:
1326: public void uninstallUI(JComponent c)
1327: {
1328: uninstallKeyboardActions();
1329: uninstallListeners();
1330: uninstallComponents();
1331: uninstallDefaults();
1332:
1333: optionPane = null;
1334: }
1335: }