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:
165: public class ButtonAreaLayout implements LayoutManager
166: {
167:
168: protected boolean centersChildren = true;
169:
170:
171: protected int padding;
172:
173:
174: protected boolean syncAllWidths;
175:
176:
177: private transient int widthOfWidestButton;
178:
179:
180: private transient int tallestButton;
181:
182:
189: public ButtonAreaLayout(boolean syncAllWidths, int padding)
190: {
191: this.syncAllWidths = syncAllWidths;
192: this.padding = padding;
193: }
194:
195:
201: public void addLayoutComponent(String string, Component comp)
202: {
203:
204: }
205:
206:
211: public boolean getCentersChildren()
212: {
213: return centersChildren;
214: }
215:
216:
221: public int getPadding()
222: {
223: return padding;
224: }
225:
226:
232: public boolean getSyncAllWidths()
233: {
234: return syncAllWidths;
235: }
236:
237:
242: public void layoutContainer(Container container)
243: {
244: Component[] buttonList = container.getComponents();
245: int x = container.getInsets().left;
246: if (getCentersChildren())
247: x += (int) ((double) (container.getSize().width) / 2
248: - (double) (buttonRowLength(container)) / 2);
249: for (int i = 0; i < buttonList.length; i++)
250: {
251: Dimension dims = buttonList[i].getPreferredSize();
252: if (getSizeButtonsToSameWidth())
253: {
254: buttonList[i].setBounds(x, 0, widthOfWidestButton, dims.height);
255: x += widthOfWidestButton + getPadding();
256: }
257: else
258: {
259: buttonList[i].setBounds(x, 0, dims.width, dims.height);
260: x += dims.width + getPadding();
261: }
262: }
263: }
264:
265:
273: private int buttonRowLength(Container c)
274: {
275: Component[] buttonList = c.getComponents();
276:
277: int buttonLength = 0;
278: int widest = 0;
279: int tallest = 0;
280:
281: for (int i = 0; i < buttonList.length; i++)
282: {
283: Dimension dims = buttonList[i].getPreferredSize();
284: buttonLength += dims.width + getPadding();
285: widest = Math.max(widest, dims.width);
286: tallest = Math.max(tallest, dims.height);
287: }
288:
289: widthOfWidestButton = widest;
290: tallestButton = tallest;
291:
292: int width;
293: if (getSyncAllWidths())
294: width = widest * buttonList.length
295: + getPadding() * (buttonList.length - 1);
296: else
297: width = buttonLength;
298:
299: Insets insets = c.getInsets();
300: width += insets.left + insets.right;
301:
302: return width;
303: }
304:
305:
312: public Dimension minimumLayoutSize(Container c)
313: {
314: return preferredLayoutSize(c);
315: }
316:
317:
324: public Dimension preferredLayoutSize(Container c)
325: {
326: int w = buttonRowLength(c);
327:
328: return new Dimension(w, tallestButton);
329: }
330:
331:
337: public void removeLayoutComponent(Component c)
338: {
339:
340: }
341:
342:
347: public void setCentersChildren(boolean newValue)
348: {
349: centersChildren = newValue;
350: optionPane.invalidate();
351: }
352:
353:
358: public void setPadding(int newPadding)
359: {
360: padding = newPadding;
361: optionPane.invalidate();
362: }
363:
364:
369: public void setSyncAllWidths(boolean newValue)
370: {
371: syncAllWidths = newValue;
372: optionPane.invalidate();
373: }
374: }
375:
376:
383: public class PropertyChangeHandler implements PropertyChangeListener
384: {
385:
391: public void propertyChange(PropertyChangeEvent e)
392: {
393: if (e.getPropertyName().equals(JOptionPane.ICON_PROPERTY)
394: || e.getPropertyName().equals(JOptionPane.MESSAGE_TYPE_PROPERTY))
395: addIcon(messageAreaContainer);
396: else if (e.getPropertyName().equals(JOptionPane.INITIAL_SELECTION_VALUE_PROPERTY))
397: resetSelectedValue();
398: else if (e.getPropertyName().equals(JOptionPane.INITIAL_VALUE_PROPERTY)
399: || e.getPropertyName().equals(JOptionPane.OPTIONS_PROPERTY)
400: || e.getPropertyName().equals(JOptionPane.OPTION_TYPE_PROPERTY))
401: {
402: Container newButtons = createButtonArea();
403: optionPane.remove(buttonContainer);
404: optionPane.add(newButtons);
405: buttonContainer = newButtons;
406: }
407:
408: else if (e.getPropertyName().equals(JOptionPane.MESSAGE_PROPERTY)
409: || e.getPropertyName().equals(JOptionPane.WANTS_INPUT_PROPERTY)
410: || e.getPropertyName().equals(JOptionPane.SELECTION_VALUES_PROPERTY))
411: {
412: optionPane.removeAll();
413: messageAreaContainer = createMessageArea();
414: optionPane.add(messageAreaContainer);
415: optionPane.add(buttonContainer);
416: }
417: optionPane.invalidate();
418: optionPane.repaint();
419: }
420: }
421:
422:
423: protected boolean hasCustomComponents = false;
424:
425:
426:
427:
428:
429:
430:
435: protected Component initialFocusComponent;
436:
437:
438: protected JComponent inputComponent;
439:
440:
441: public static int minimumHeight;
442:
443:
444: public static int minimumWidth;
445:
446:
447: protected Dimension minimumSize;
448:
449:
450: protected PropertyChangeListener propertyChangeListener;
451:
452:
453: protected JOptionPane optionPane;
454:
455:
456:
457: private static final int iconSize = 36;
458:
459:
460: private transient Color messageForeground;
461:
462:
463: private transient Border messageBorder;
464:
465:
466: private transient Border buttonBorder;
467:
468:
469: private static final String OK_STRING = "OK";
470:
471:
472: private static final String YES_STRING = "Yes";
473:
474:
475: private static final String NO_STRING = "No";
476:
477:
478: private static final String CANCEL_STRING = "Cancel";
479:
480:
482: transient Container messageAreaContainer;
483:
484:
486: transient Container buttonContainer;
487:
488:
492: private static class MessageIcon implements Icon
493: {
494:
499: public int getIconWidth()
500: {
501: return iconSize;
502: }
503:
504:
509: public int getIconHeight()
510: {
511: return iconSize;
512: }
513:
514:
523: public void paintIcon(Component c, Graphics g, int x, int y)
524: {
525: }
526: }
527:
528:
529: private static MessageIcon errorIcon = new MessageIcon()
530: {
531: public void paintIcon(Component c, Graphics g, int x, int y)
532: {
533: Polygon oct = new Polygon(new int[] { 0, 0, 9, 27, 36, 36, 27, 9 },
534: new int[] { 9, 27, 36, 36, 27, 9, 0, 0 }, 8);
535: g.translate(x, y);
536:
537: Color saved = g.getColor();
538: g.setColor(Color.RED);
539:
540: g.fillPolygon(oct);
541:
542: g.setColor(Color.BLACK);
543: g.drawRect(13, 16, 10, 4);
544:
545: g.setColor(saved);
546: g.translate(-x, -y);
547: }
548: };
549:
550:
551: private static MessageIcon infoIcon = new MessageIcon()
552: {
553: public void paintIcon(Component c, Graphics g, int x, int y)
554: {
555: g.translate(x, y);
556: Color saved = g.getColor();
557:
558:
559: g.setColor(Color.RED);
560:
561: g.fillOval(0, 0, iconSize, iconSize);
562:
563: g.setColor(Color.BLACK);
564: g.drawOval(16, 6, 4, 4);
565:
566: Polygon bottomI = new Polygon(new int[] { 15, 15, 13, 13, 23, 23, 21, 21 },
567: new int[] { 12, 28, 28, 30, 30, 28, 28, 12 },
568: 8);
569: g.drawPolygon(bottomI);
570:
571: g.setColor(saved);
572: g.translate(-x, -y);
573: }
574: };
575:
576:
577: private static MessageIcon warningIcon = new MessageIcon()
578: {
579: public void paintIcon(Component c, Graphics g, int x, int y)
580: {
581: g.translate(x, y);
582: Color saved = g.getColor();
583: g.setColor(Color.YELLOW);
584:
585: Polygon triangle = new Polygon(new int[] { 0, 18, 36 },
586: new int[] { 36, 0, 36 }, 3);
587: g.fillPolygon(triangle);
588:
589: g.setColor(Color.BLACK);
590:
591: Polygon excl = new Polygon(new int[] { 15, 16, 20, 21 },
592: new int[] { 8, 26, 26, 8 }, 4);
593: g.drawPolygon(excl);
594: g.drawOval(16, 30, 4, 4);
595:
596: g.setColor(saved);
597: g.translate(-x, -y);
598: }
599: };
600:
601:
602: private static MessageIcon questionIcon = new MessageIcon()
603: {
604: public void paintIcon(Component c, Graphics g, int x, int y)
605: {
606: g.translate(x, y);
607: Color saved = g.getColor();
608: g.setColor(Color.GREEN);
609:
610: g.fillRect(0, 0, iconSize, iconSize);
611:
612: g.setColor(Color.BLACK);
613:
614: g.drawOval(11, 2, 16, 16);
615: g.drawOval(14, 5, 10, 10);
616:
617: g.setColor(Color.GREEN);
618: g.fillRect(0, 10, iconSize, iconSize - 10);
619:
620: g.setColor(Color.BLACK);
621:
622: g.drawLine(11, 10, 14, 10);
623:
624: g.drawLine(24, 10, 17, 22);
625: g.drawLine(27, 10, 20, 22);
626: g.drawLine(17, 22, 20, 22);
627:
628: g.drawOval(17, 25, 3, 3);
629:
630: g.setColor(saved);
631: g.translate(-x, -y);
632: }
633: };
634:
635:
636:
637:
638:
639:
642: public BasicOptionPaneUI()
643: {
644: }
645:
646:
657: protected void addButtonComponents(Container container, Object[] buttons,
658: int initialIndex)
659: {
660: if (buttons == null)
661: return;
662: for (int i = 0; i < buttons.length; i++)
663: {
664: if (buttons[i] != null)
665: {
666: Component toAdd;
667: if (buttons[i] instanceof Component)
668: toAdd = (Component) buttons[i];
669: else
670: {
671: if (buttons[i] instanceof Icon)
672: toAdd = new JButton((Icon) buttons[i]);
673: else
674: toAdd = new JButton(buttons[i].toString());
675: hasCustomComponents = true;
676: }
677: if (toAdd instanceof JButton)
678: ((JButton) toAdd).addActionListener(createButtonActionListener(i));
679: if (i == initialIndex)
680: initialFocusComponent = toAdd;
681: container.add(toAdd);
682: }
683: }
684: selectInitialValue(optionPane);
685: }
686:
687:
692: protected void addIcon(Container top)
693: {
694: JLabel iconLabel = null;
695: Icon icon = getIcon();
696: if (icon != null)
697: {
698: iconLabel = new JLabel(icon);
699: top.add(iconLabel, BorderLayout.WEST);
700: }
701: }
702:
703:
709: private static GridBagConstraints createConstraints()
710: {
711: GridBagConstraints constraints = new GridBagConstraints();
712: constraints.gridx = GridBagConstraints.REMAINDER;
713: constraints.gridy = GridBagConstraints.REMAINDER;
714: constraints.gridwidth = 0;
715: constraints.anchor = GridBagConstraints.LINE_START;
716: constraints.fill = GridBagConstraints.NONE;
717: constraints.insets = new Insets(0, 0, 3, 0);
718:
719: return constraints;
720: }
721:
722:
738: protected void addMessageComponents(Container container,
739: GridBagConstraints cons, Object msg,
740: int maxll, boolean internallyCreated)
741: {
742: if (msg == null)
743: return;
744: hasCustomComponents = internallyCreated;
745: if (msg instanceof Object[])
746: {
747: Object[] arr = (Object[]) msg;
748: for (int i = 0; i < arr.length; i++)
749: addMessageComponents(container, cons, arr[i], maxll,
750: internallyCreated);
751: return;
752: }
753: else if (msg instanceof Component)
754: {
755: container.add((Component) msg, cons);
756: cons.gridy++;
757: }
758: else if (msg instanceof Icon)
759: {
760: container.add(new JLabel((Icon) msg), cons);
761: cons.gridy++;
762: }
763: else
764: {
765:
766:
767:
768:
769:
770: if (msg.toString().length() > maxll)
771: {
772: Box tmp = new Box(BoxLayout.Y_AXIS);
773: burstStringInto(tmp, msg.toString(), maxll);
774: addMessageComponents(container, cons, tmp, maxll, true);
775: }
776: else
777: addMessageComponents(container, cons, new JLabel(msg.toString()),
778: maxll, true);
779: }
780: }
781:
782:
790: protected void burstStringInto(Container c, String d, int maxll)
791: {
792:
793:
794:
795:
796:
797:
798:
799: if (d == null || c == null)
800: return;
801: JLabel label = new JLabel(d);
802: c.add(label);
803: }
804:
805:
813: public boolean containsCustomComponents(JOptionPane op)
814: {
815: return hasCustomComponents;
816: }
817:
818:
825: protected ActionListener createButtonActionListener(int buttonIndex)
826: {
827: return new ButtonActionListener(buttonIndex);
828: }
829:
830:
835: protected Container createButtonArea()
836: {
837: JPanel buttonPanel = new JPanel();
838:
839: buttonPanel.setLayout(createLayoutManager());
840: addButtonComponents(buttonPanel, getButtons(), getInitialValueIndex());
841:
842: return buttonPanel;
843: }
844:
845:
850: protected LayoutManager createLayoutManager()
851: {
852: return new ButtonAreaLayout(getSizeButtonsToSameWidth(), 6);
853: }
854:
855:
860: protected Container createMessageArea()
861: {
862: JPanel messageArea = new JPanel();
863: messageArea.setLayout(new BorderLayout());
864: addIcon(messageArea);
865:
866: JPanel rightSide = new JPanel();
867: rightSide.setBorder(BorderFactory.createEmptyBorder(0, 11, 17, 0));
868: rightSide.setLayout(new GridBagLayout());
869: GridBagConstraints con = createConstraints();
870:
871: addMessageComponents(rightSide, con, getMessage(),
872: getMaxCharactersPerLineCount(), false);
873:
874: if (optionPane.getWantsInput())
875: {
876: Object[] selection = optionPane.getSelectionValues();
877:
878: if (selection == null)
879: inputComponent = new JTextField(15);
880: else if (selection.length < 20)
881: inputComponent = new JComboBox(selection);
882: else
883: inputComponent = new JList(selection);
884: if (inputComponent != null)
885: {
886: addMessageComponents(rightSide, con, inputComponent,
887: getMaxCharactersPerLineCount(), false);
888: resetSelectedValue();
889: selectInitialValue(optionPane);
890: }
891: }
892:
893: messageArea.add(rightSide, BorderLayout.EAST);
894:
895: return messageArea;
896: }
897:
898:
904: protected PropertyChangeListener createPropertyChangeListener()
905: {
906: return new PropertyChangeHandler();
907: }
908:
909:
915: protected Container createSeparator()
916: {
917: return (Container) Box.createVerticalStrut(17);
918: }
919:
920:
927: public static ComponentUI createUI(JComponent x)
928: {
929: return new BasicOptionPaneUI();
930: }
931:
932:
938: protected Object[] getButtons()
939: {
940: if (optionPane.getOptions() != null)
941: return optionPane.getOptions();
942: switch (optionPane.getOptionType())
943: {
944: case JOptionPane.YES_NO_OPTION:
945: return new Object[] { YES_STRING, NO_STRING };
946: case JOptionPane.YES_NO_CANCEL_OPTION:
947: return new Object[] { YES_STRING, NO_STRING, CANCEL_STRING };
948: case JOptionPane.OK_CANCEL_OPTION:
949: case JOptionPane.DEFAULT_OPTION:
950: return new Object[] { OK_STRING, CANCEL_STRING };
951: }
952: return null;
953: }
954:
955:
961: protected Icon getIcon()
962: {
963: if (optionPane.getIcon() != null)
964: return optionPane.getIcon();
965: else
966: return getIconForType(optionPane.getMessageType());
967: }
968:
969:
976: protected Icon getIconForType(int messageType)
977: {
978: Icon tmp = null;
979: switch (messageType)
980: {
981: case JOptionPane.ERROR_MESSAGE:
982: tmp = errorIcon;
983: break;
984: case JOptionPane.INFORMATION_MESSAGE:
985: tmp = infoIcon;
986: break;
987: case JOptionPane.WARNING_MESSAGE:
988: tmp = warningIcon;
989: break;
990: case JOptionPane.QUESTION_MESSAGE:
991: tmp = questionIcon;
992: break;
993: }
994: return tmp;
995:
996:
997: }
998:
999:
1004: protected int getInitialValueIndex()
1005: {
1006: Object[] buttons = getButtons();
1007:
1008: if (buttons == null)
1009: return -1;
1010:
1011: Object select = optionPane.getInitialValue();
1012:
1013: for (int i = 0; i < buttons.length; i++)
1014: {
1015: if (select == buttons[i])
1016: return i;
1017: }
1018: return 0;
1019: }
1020:
1021:
1028: protected int getMaxCharactersPerLineCount()
1029: {
1030: return optionPane.getMaxCharactersPerLineCount();
1031: }
1032:
1033:
1040: public Dimension getMaximumSize(JComponent c)
1041: {
1042: return getPreferredSize(c);
1043: }
1044:
1045:
1050: protected Object getMessage()
1051: {
1052: return optionPane.getMessage();
1053: }
1054:
1055:
1060: public Dimension getMinimumOptionPaneSize()
1061: {
1062: return minimumSize;
1063: }
1064:
1065:
1072: public Dimension getMinimumSize(JComponent c)
1073: {
1074: return getPreferredSize(c);
1075: }
1076:
1077:
1086: public Dimension getPreferredSize(JComponent c)
1087: {
1088: Dimension d = optionPane.getLayout().preferredLayoutSize(optionPane);
1089: Dimension d2 = getMinimumOptionPaneSize();
1090:
1091: int w = Math.max(d.width, d2.width);
1092: int h = Math.max(d.height, d2.height);
1093: return new Dimension(w, h);
1094: }
1095:
1096:
1101: protected boolean getSizeButtonsToSameWidth()
1102: {
1103: return true;
1104: }
1105:
1106:
1109: protected void installComponents()
1110: {
1111:
1112: hasCustomComponents = false;
1113: Container msg = createMessageArea();
1114: if (msg != null)
1115: {
1116: ((JComponent) msg).setBorder(messageBorder);
1117: msg.setForeground(messageForeground);
1118: messageAreaContainer = msg;
1119: optionPane.add(msg);
1120: }
1121:
1122: Container sep = createSeparator();
1123: if (sep != null)
1124: optionPane.add(sep);
1125:
1126: Container button = createButtonArea();
1127: if (button != null)
1128: {
1129: ((JComponent) button).setBorder(buttonBorder);
1130: buttonContainer = button;
1131: optionPane.add(button);
1132: }
1133:
1134: optionPane.setBorder(BorderFactory.createEmptyBorder(12, 12, 11, 11));
1135: optionPane.invalidate();
1136: }
1137:
1138:
1141: protected void installDefaults()
1142: {
1143: UIDefaults defaults = UIManager.getLookAndFeelDefaults();
1144:
1145: optionPane.setFont(defaults.getFont("OptionPane.font"));
1146: optionPane.setBackground(defaults.getColor("OptionPane.background"));
1147: optionPane.setForeground(defaults.getColor("OptionPane.foreground"));
1148: optionPane.setBorder(defaults.getBorder("OptionPane.border"));
1149: optionPane.setOpaque(true);
1150:
1151: messageBorder = defaults.getBorder("OptionPane.messageAreaBorder");
1152: messageForeground = defaults.getColor("OptionPane.messageForeground");
1153: buttonBorder = defaults.getBorder("OptionPane.buttonAreaBorder");
1154:
1155: minimumSize = defaults.getDimension("OptionPane.minimumSize");
1156: minimumWidth = minimumSize.width;
1157: minimumHeight = minimumSize.height;
1158:
1159:
1160:
1161:
1162:
1168: }
1169:
1170:
1173: protected void installKeyboardActions()
1174: {
1175:
1176: }
1177:
1178:
1181: protected void installListeners()
1182: {
1183: propertyChangeListener = createPropertyChangeListener();
1184:
1185: optionPane.addPropertyChangeListener(propertyChangeListener);
1186: }
1187:
1188:
1193: public void installUI(JComponent c)
1194: {
1195: if (c instanceof JOptionPane)
1196: {
1197: optionPane = (JOptionPane) c;
1198:
1199: installDefaults();
1200: installComponents();
1201: installListeners();
1202: installKeyboardActions();
1203: }
1204: }
1205:
1206:
1210: protected void resetInputValue()
1211: {
1212: if (optionPane.getWantsInput() && inputComponent != null)
1213: {
1214: Object output = null;
1215: if (inputComponent instanceof JTextField)
1216: output = ((JTextField) inputComponent).getText();
1217: else if (inputComponent instanceof JComboBox)
1218: output = ((JComboBox) inputComponent).getSelectedItem();
1219: else if (inputComponent instanceof JList)
1220: output = ((JList) inputComponent).getSelectedValue();
1221:
1222: if (output != null)
1223: optionPane.setInputValue(output);
1224: }
1225: }
1226:
1227:
1233: public void selectInitialValue(JOptionPane op)
1234: {
1235: if (inputComponent != null)
1236: {
1237: inputComponent.requestFocus();
1238: return;
1239: }
1240: if (initialFocusComponent != null)
1241: initialFocusComponent.requestFocus();
1242: }
1243:
1244:
1249: void resetSelectedValue()
1250: {
1251: if (inputComponent != null)
1252: {
1253: Object init = optionPane.getInitialSelectionValue();
1254: if (init == null)
1255: return;
1256: if (inputComponent instanceof JTextField)
1257: ((JTextField) inputComponent).setText((String) init);
1258: else if (inputComponent instanceof JComboBox)
1259: ((JComboBox) inputComponent).setSelectedItem(init);
1260: else if (inputComponent instanceof JList)
1261: {
1262:
1263: }
1264: }
1265: }
1266:
1267:
1270: protected void uninstallComponents()
1271: {
1272: optionPane.removeAll();
1273: buttonContainer = null;
1274: messageAreaContainer = null;
1275: }
1276:
1277:
1280: protected void uninstallDefaults()
1281: {
1282: optionPane.setFont(null);
1283: optionPane.setForeground(null);
1284: optionPane.setBackground(null);
1285:
1286: minimumSize = null;
1287:
1288: messageBorder = null;
1289: buttonBorder = null;
1290: messageForeground = null;
1291:
1292:
1293:
1294:
1300: }
1301:
1302:
1305: protected void uninstallKeyboardActions()
1306: {
1307:
1308: }
1309:
1310:
1313: protected void uninstallListeners()
1314: {
1315: optionPane.removePropertyChangeListener(propertyChangeListener);
1316: propertyChangeListener = null;
1317: }
1318:
1319:
1324: public void uninstallUI(JComponent c)
1325: {
1326: uninstallKeyboardActions();
1327: uninstallListeners();
1328: uninstallComponents();
1329: uninstallDefaults();
1330:
1331: optionPane = null;
1332: }
1333: }