KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > swing > JColorChooser


1 /*
2  * @(#)JColorChooser.java 1.48 06/04/10
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.swing;
9
10 import java.awt.*;
11 import java.awt.event.*;
12 import java.beans.*;
13 import java.io.*;
14 import java.util.*;
15
16 import javax.swing.colorchooser.*;
17 import javax.swing.plaf.ColorChooserUI JavaDoc;
18 import javax.swing.event.*;
19 import javax.accessibility.*;
20
21
22 /**
23  * <code>JColorChooser</code> provides a pane of controls designed to allow
24  * a user to manipulate and select a color.
25  * For information about using color choosers, see
26  * <a
27  href="http://java.sun.com/docs/books/tutorial/uiswing/components/colorchooser.html">How to Use Color Choosers</a>,
28  * a section in <em>The Java Tutorial</em>.
29  *
30  * <p>
31  *
32  * This class provides three levels of API:
33  * <ol>
34  * <li>A static convenience method which shows a modal color-chooser
35  * dialog and returns the color selected by the user.
36  * <li>A static convenience method for creating a color-chooser dialog
37  * where <code>ActionListeners</code> can be specified to be invoked when
38  * the user presses one of the dialog buttons.
39  * <li>The ability to create instances of <code>JColorChooser</code> panes
40  * directly (within any container). <code>PropertyChange</code> listeners
41  * can be added to detect when the current "color" property changes.
42  * </ol>
43  * <p>
44  * <strong>Warning:</strong>
45  * Serialized objects of this class will not be compatible with
46  * future Swing releases. The current serialization support is
47  * appropriate for short term storage or RMI between applications running
48  * the same version of Swing. As of 1.4, support for long term storage
49  * of all JavaBeans<sup><font size="-2">TM</font></sup>
50  * has been added to the <code>java.beans</code> package.
51  * Please see {@link java.beans.XMLEncoder}.
52  *
53  *
54  * @beaninfo
55  * attribute: isContainer false
56  * description: A component that supports selecting a Color.
57  *
58  *
59  * @version 1.48 04/10/06
60  * @author James Gosling
61  * @author Amy Fowler
62  * @author Steve Wilson
63  */

64 public class JColorChooser extends JComponent JavaDoc implements Accessible {
65
66     /**
67      * @see #getUIClassID
68      * @see #readObject
69      */

70     private static final String JavaDoc uiClassID = "ColorChooserUI";
71
72     private ColorSelectionModel selectionModel;
73
74     private JComponent JavaDoc previewPanel;
75
76     private AbstractColorChooserPanel[] chooserPanels = new AbstractColorChooserPanel[0];
77
78     private boolean dragEnabled;
79
80     /**
81      * The selection model property name.
82      */

83     public static final String JavaDoc SELECTION_MODEL_PROPERTY = "selectionModel";
84
85     /**
86      * The preview panel property name.
87      */

88     public static final String JavaDoc PREVIEW_PANEL_PROPERTY = "previewPanel";
89
90     /**
91      * The chooserPanel array property name.
92      */

93     public static final String JavaDoc CHOOSER_PANELS_PROPERTY = "chooserPanels";
94
95
96     /**
97      * Shows a modal color-chooser dialog and blocks until the
98      * dialog is hidden. If the user presses the "OK" button, then
99      * this method hides/disposes the dialog and returns the selected color.
100      * If the user presses the "Cancel" button or closes the dialog without
101      * pressing "OK", then this method hides/disposes the dialog and returns
102      * <code>null</code>.
103      *
104      * @param component the parent <code>Component</code> for the dialog
105      * @param title the String containing the dialog's title
106      * @param initialColor the initial Color set when the color-chooser is shown
107      * @return the selected color or <code>null</code> if the user opted out
108      * @exception HeadlessException if GraphicsEnvironment.isHeadless()
109      * returns true.
110      * @see java.awt.GraphicsEnvironment#isHeadless
111      */

112     public static Color showDialog(Component component,
113         String JavaDoc title, Color initialColor) throws HeadlessException {
114
115         final JColorChooser JavaDoc pane = new JColorChooser JavaDoc(initialColor != null?
116                                                initialColor : Color.white);
117
118         ColorTracker ok = new ColorTracker(pane);
119         JDialog JavaDoc dialog = createDialog(component, title, true, pane, ok, null);
120
121         dialog.show(); // blocks until user brings dialog down...
122

123         return ok.getColor();
124     }
125
126
127     /**
128      * Creates and returns a new dialog containing the specified
129      * <code>ColorChooser</code> pane along with "OK", "Cancel", and "Reset"
130      * buttons. If the "OK" or "Cancel" buttons are pressed, the dialog is
131      * automatically hidden (but not disposed). If the "Reset"
132      * button is pressed, the color-chooser's color will be reset to the
133      * color which was set the last time <code>show</code> was invoked on the
134      * dialog and the dialog will remain showing.
135      *
136      * @param c the parent component for the dialog
137      * @param title the title for the dialog
138      * @param modal a boolean. When true, the remainder of the program
139      * is inactive until the dialog is closed.
140      * @param chooserPane the color-chooser to be placed inside the dialog
141      * @param okListener the ActionListener invoked when "OK" is pressed
142      * @param cancelListener the ActionListener invoked when "Cancel" is pressed
143      * @return a new dialog containing the color-chooser pane
144      * @exception HeadlessException if GraphicsEnvironment.isHeadless()
145      * returns true.
146      * @see java.awt.GraphicsEnvironment#isHeadless
147      */

148     public static JDialog JavaDoc createDialog(Component c, String JavaDoc title, boolean modal,
149         JColorChooser JavaDoc chooserPane, ActionListener okListener,
150         ActionListener cancelListener) throws HeadlessException {
151
152         Window window = JOptionPane.getWindowForComponent(c);
153     ColorChooserDialog dialog;
154         if (window instanceof Frame) {
155             dialog = new ColorChooserDialog((Frame)window, title, modal, c, chooserPane,
156                         okListener, cancelListener);
157         } else {
158             dialog = new ColorChooserDialog((Dialog)window, title, modal, c, chooserPane,
159                         okListener, cancelListener);
160         }
161     return dialog;
162     }
163
164     /**
165      * Creates a color chooser pane with an initial color of white.
166      */

167     public JColorChooser() {
168         this(Color.white);
169     }
170
171     /**
172      * Creates a color chooser pane with the specified initial color.
173      *
174      * @param initialColor the initial color set in the chooser
175      */

176     public JColorChooser(Color initialColor) {
177     this( new DefaultColorSelectionModel(initialColor) );
178
179     }
180
181     /**
182      * Creates a color chooser pane with the specified
183      * <code>ColorSelectionModel</code>.
184      *
185      * @param model the <code>ColorSelectionModel</code> to be used
186      */

187     public JColorChooser(ColorSelectionModel model) {
188     selectionModel = model;
189         updateUI();
190     dragEnabled = false;
191     }
192
193     /**
194      * Returns the L&F object that renders this component.
195      *
196      * @return the <code>ColorChooserUI</code> object that renders
197      * this component
198      */

199     public ColorChooserUI JavaDoc getUI() {
200         return (ColorChooserUI JavaDoc)ui;
201     }
202
203     /**
204      * Sets the L&F object that renders this component.
205      *
206      * @param ui the <code>ColorChooserUI</code> L&F object
207      * @see UIDefaults#getUI
208      *
209      * @beaninfo
210      * bound: true
211      * hidden: true
212      * description: The UI object that implements the color chooser's LookAndFeel.
213      */

214     public void setUI(ColorChooserUI JavaDoc ui) {
215         super.setUI(ui);
216     }
217
218     /**
219      * Notification from the <code>UIManager</code> that the L&F has changed.
220      * Replaces the current UI object with the latest version from the
221      * <code>UIManager</code>.
222      *
223      * @see JComponent#updateUI
224      */

225     public void updateUI() {
226         setUI((ColorChooserUI JavaDoc)UIManager.getUI(this));
227     }
228
229     /**
230      * Returns the name of the L&F class that renders this component.
231      *
232      * @return the string "ColorChooserUI"
233      * @see JComponent#getUIClassID
234      * @see UIDefaults#getUI
235      */

236     public String JavaDoc getUIClassID() {
237         return uiClassID;
238     }
239
240     /**
241      * Gets the current color value from the color chooser.
242      * By default, this delegates to the model.
243      *
244      * @return the current color value of the color chooser
245      */

246     public Color getColor() {
247         return selectionModel.getSelectedColor();
248     }
249
250     /**
251      * Sets the current color of the color chooser to the specified color.
252      * The <code>ColorSelectionModel</code> will fire a <code>ChangeEvent</code>
253      * @param color the color to be set in the color chooser
254      * @see JComponent#addPropertyChangeListener
255      *
256      * @beaninfo
257      * bound: false
258      * hidden: false
259      * description: The current color the chooser is to display.
260      */

261     public void setColor(Color color) {
262         selectionModel.setSelectedColor(color);
263
264     }
265
266     /**
267      * Sets the current color of the color chooser to the
268      * specified RGB color. Note that the values of red, green,
269      * and blue should be between the numbers 0 and 255, inclusive.
270      *
271      * @param r an int specifying the amount of Red
272      * @param g an int specifying the amount of Green
273      * @param b an int specifying the amount of Blue
274      * @exception IllegalArgumentException if r,g,b values are out of range
275      * @see java.awt.Color
276      */

277     public void setColor(int r, int g, int b) {
278         setColor(new Color(r,g,b));
279     }
280
281     /**
282      * Sets the current color of the color chooser to the
283      * specified color.
284      *
285      * @param c an integer value that sets the current color in the chooser
286      * where the low-order 8 bits specify the Blue value,
287      * the next 8 bits specify the Green value, and the 8 bits
288      * above that specify the Red value.
289      */

290     public void setColor(int c) {
291         setColor((c >> 16) & 0xFF, (c >> 8) & 0xFF, c & 0xFF);
292     }
293
294     /**
295      * Sets the <code>dragEnabled</code> property,
296      * which must be <code>true</code> to enable
297      * automatic drag handling (the first part of drag and drop)
298      * on this component.
299      * The <code>transferHandler</code> property needs to be set
300      * to a non-<code>null</code> value for the drag to do
301      * anything. The default value of the <code>dragEnabled</code>
302      * property
303      * is <code>false</code>.
304      *
305      * <p>
306      *
307      * When automatic drag handling is enabled,
308      * most look and feels begin a drag-and-drop operation
309      * when the user presses the mouse button over the preview panel.
310      * Some look and feels might not support automatic drag and drop;
311      * they will ignore this property. You can work around such
312      * look and feels by modifying the component
313      * to directly call the <code>exportAsDrag</code> method of a
314      * <code>TransferHandler</code>.
315      *
316      * @param b the value to set the <code>dragEnabled</code> property to
317      * @exception HeadlessException if
318      * <code>b</code> is <code>true</code> and
319      * <code>GraphicsEnvironment.isHeadless()</code>
320      * returns <code>true</code>
321      *
322      * @since 1.4
323      *
324      * @see java.awt.GraphicsEnvironment#isHeadless
325      * @see #getDragEnabled
326      * @see #setTransferHandler
327      * @see TransferHandler
328      *
329      * @beaninfo
330      * description: Determines whether automatic drag handling is enabled.
331      * bound: false
332      */

333     public void setDragEnabled(boolean b) {
334         if (b && GraphicsEnvironment.isHeadless()) {
335             throw new HeadlessException();
336         }
337     dragEnabled = b;
338     }
339
340     /**
341      * Gets the value of the <code>dragEnabled</code> property.
342      *
343      * @return the value of the <code>dragEnabled</code> property
344      * @see #setDragEnabled
345      * @since 1.4
346      */

347     public boolean getDragEnabled() {
348     return dragEnabled;
349     }
350
351     /**
352      * Sets the current preview panel.
353      * This will fire a <code>PropertyChangeEvent</code> for the property
354      * named "previewPanel".
355      *
356      * @param preview the <code>JComponent</code> which displays the current color
357      * @see JComponent#addPropertyChangeListener
358      *
359      * @beaninfo
360      * bound: true
361      * hidden: true
362      * description: The UI component which displays the current color.
363      */

364     public void setPreviewPanel(JComponent JavaDoc preview) {
365
366         if (previewPanel != preview) {
367         JComponent JavaDoc oldPreview = previewPanel;
368         previewPanel = preview;
369             firePropertyChange(JColorChooser.PREVIEW_PANEL_PROPERTY, oldPreview, preview);
370         }
371     }
372
373     /**
374      * Returns the preview panel that shows a chosen color.
375      *
376      * @return a <code>JComponent</code> object -- the preview panel
377      */

378     public JComponent JavaDoc getPreviewPanel() {
379         return previewPanel;
380     }
381
382     /**
383      * Adds a color chooser panel to the color chooser.
384      *
385      * @param panel the <code>AbstractColorChooserPanel</code> to be added
386      */

387     public void addChooserPanel( AbstractColorChooserPanel panel ) {
388         AbstractColorChooserPanel[] oldPanels = getChooserPanels();
389         AbstractColorChooserPanel[] newPanels = new AbstractColorChooserPanel[oldPanels.length+1];
390     System.arraycopy(oldPanels, 0, newPanels, 0, oldPanels.length);
391     newPanels[newPanels.length-1] = panel;
392     setChooserPanels(newPanels);
393     }
394
395     /**
396      * Removes the Color Panel specified.
397      *
398      * @param panel a string that specifies the panel to be removed
399      * @return the color panel
400      * @exception IllegalArgumentException if panel is not in list of
401      * known chooser panels
402      */

403     public AbstractColorChooserPanel removeChooserPanel( AbstractColorChooserPanel panel ) {
404
405
406     int containedAt = -1;
407
408         for (int i = 0; i < chooserPanels.length; i++) {
409         if (chooserPanels[i] == panel) {
410             containedAt = i;
411         break;
412         }
413     }
414     if (containedAt == -1) {
415         throw new IllegalArgumentException JavaDoc("chooser panel not in this chooser");
416     }
417
418         AbstractColorChooserPanel[] newArray = new AbstractColorChooserPanel[chooserPanels.length-1];
419
420     if (containedAt == chooserPanels.length-1) { // at end
421
System.arraycopy(chooserPanels, 0, newArray, 0, newArray.length);
422     }
423     else if (containedAt == 0) { // at start
424
System.arraycopy(chooserPanels, 1, newArray, 0, newArray.length);
425     }
426     else { // in middle
427
System.arraycopy(chooserPanels, 0, newArray, 0, containedAt);
428         System.arraycopy(chooserPanels, containedAt+1,
429                  newArray, containedAt, (chooserPanels.length - containedAt - 1));
430     }
431
432     setChooserPanels(newArray);
433
434     return panel;
435     }
436
437
438     /**
439      * Specifies the Color Panels used to choose a color value.
440      *
441      * @param panels an array of <code>AbstractColorChooserPanel</code>
442      * objects
443      *
444      * @beaninfo
445      * bound: true
446      * hidden: true
447      * description: An array of different chooser types.
448      */

449     public void setChooserPanels( AbstractColorChooserPanel[] panels) {
450         AbstractColorChooserPanel[] oldValue = chooserPanels;
451     chooserPanels = panels;
452     firePropertyChange(CHOOSER_PANELS_PROPERTY, oldValue, panels);
453     }
454
455     /**
456      * Returns the specified color panels.
457      *
458      * @return an array of <code>AbstractColorChooserPanel</code> objects
459      */

460     public AbstractColorChooserPanel[] getChooserPanels() {
461         return chooserPanels;
462     }
463
464     /**
465      * Returns the data model that handles color selections.
466      *
467      * @return a <code>ColorSelectionModel</code> object
468      */

469     public ColorSelectionModel getSelectionModel() {
470         return selectionModel;
471     }
472
473
474     /**
475      * Sets the model containing the selected color.
476      *
477      * @param newModel the new <code>ColorSelectionModel</code> object
478      *
479      * @beaninfo
480      * bound: true
481      * hidden: true
482      * description: The model which contains the currently selected color.
483      */

484     public void setSelectionModel(ColorSelectionModel newModel ) {
485         ColorSelectionModel oldModel = selectionModel;
486     selectionModel = newModel;
487     firePropertyChange(JColorChooser.SELECTION_MODEL_PROPERTY, oldModel, newModel);
488     }
489
490
491     /**
492      * See <code>readObject</code> and <code>writeObject</code> in
493      * <code>JComponent</code> for more
494      * information about serialization in Swing.
495      */

496     private void writeObject(ObjectOutputStream s) throws IOException {
497         s.defaultWriteObject();
498         if (getUIClassID().equals(uiClassID)) {
499             byte count = JComponent.getWriteObjCounter(this);
500             JComponent.setWriteObjCounter(this, --count);
501             if (count == 0 && ui != null) {
502                 ui.installUI(this);
503             }
504         }
505     }
506
507
508     /**
509      * Returns a string representation of this <code>JColorChooser</code>.
510      * This method
511      * is intended to be used only for debugging purposes, and the
512      * content and format of the returned string may vary between
513      * implementations. The returned string may be empty but may not
514      * be <code>null</code>.
515      *
516      * @return a string representation of this <code>JColorChooser</code>
517      */

518     protected String JavaDoc paramString() {
519     StringBuffer JavaDoc chooserPanelsString = new StringBuffer JavaDoc("");
520     for (int i=0; i<chooserPanels.length; i++) {
521         chooserPanelsString.append("[" + chooserPanels[i].toString()
522                        + "]");
523     }
524         String JavaDoc previewPanelString = (previewPanel != null ?
525                      previewPanel.toString() : "");
526
527         return super.paramString() +
528         ",chooserPanels=" + chooserPanelsString.toString() +
529         ",previewPanel=" + previewPanelString;
530     }
531
532 /////////////////
533
// Accessibility support
534
////////////////
535

536     protected AccessibleContext accessibleContext = null;
537
538     /**
539      * Gets the AccessibleContext associated with this JColorChooser.
540      * For color choosers, the AccessibleContext takes the form of an
541      * AccessibleJColorChooser.
542      * A new AccessibleJColorChooser instance is created if necessary.
543      *
544      * @return an AccessibleJColorChooser that serves as the
545      * AccessibleContext of this JColorChooser
546      */

547     public AccessibleContext getAccessibleContext() {
548         if (accessibleContext == null) {
549             accessibleContext = new AccessibleJColorChooser();
550         }
551         return accessibleContext;
552     }
553
554     /**
555      * This class implements accessibility support for the
556      * <code>JColorChooser</code> class. It provides an implementation of the
557      * Java Accessibility API appropriate to color chooser user-interface
558      * elements.
559      */

560     protected class AccessibleJColorChooser extends AccessibleJComponent {
561
562         /**
563          * Get the role of this object.
564          *
565          * @return an instance of AccessibleRole describing the role of the
566          * object
567          * @see AccessibleRole
568          */

569         public AccessibleRole getAccessibleRole() {
570             return AccessibleRole.COLOR_CHOOSER;
571         }
572
573     } // inner class AccessibleJColorChooser
574
}
575
576
577 /*
578  * Class which builds a color chooser dialog consisting of
579  * a JColorChooser with "Ok", "Cancel", and "Reset" buttons.
580  *
581  * Note: This needs to be fixed to deal with localization!
582  */

583 class ColorChooserDialog extends JDialog JavaDoc {
584     private Color initialColor;
585     private JColorChooser JavaDoc chooserPane;
586     private JButton JavaDoc cancelButton;
587
588     public ColorChooserDialog(Dialog owner, String JavaDoc title, boolean modal,
589         Component c, JColorChooser JavaDoc chooserPane,
590         ActionListener okListener, ActionListener cancelListener)
591         throws HeadlessException {
592         super(owner, title, modal);
593     initColorChooserDialog(c, chooserPane, okListener, cancelListener);
594     }
595
596     public ColorChooserDialog(Frame owner, String JavaDoc title, boolean modal,
597         Component c, JColorChooser JavaDoc chooserPane,
598         ActionListener okListener, ActionListener cancelListener)
599         throws HeadlessException {
600         super(owner, title, modal);
601     initColorChooserDialog(c, chooserPane, okListener, cancelListener);
602     }
603
604     protected void initColorChooserDialog(Component c, JColorChooser JavaDoc chooserPane,
605     ActionListener okListener, ActionListener cancelListener) {
606         //setResizable(false);
607

608         this.chooserPane = chooserPane;
609
610     String JavaDoc okString = UIManager.getString("ColorChooser.okText");
611     String JavaDoc cancelString = UIManager.getString("ColorChooser.cancelText");
612     String JavaDoc resetString = UIManager.getString("ColorChooser.resetText");
613
614         Container contentPane = getContentPane();
615         contentPane.setLayout(new BorderLayout());
616         contentPane.add(chooserPane, BorderLayout.CENTER);
617
618         /*
619          * Create Lower button panel
620          */

621         JPanel JavaDoc buttonPane = new JPanel JavaDoc();
622         buttonPane.setLayout(new FlowLayout(FlowLayout.CENTER));
623         JButton JavaDoc okButton = new JButton JavaDoc(okString);
624     getRootPane().setDefaultButton(okButton);
625         okButton.setActionCommand("OK");
626         if (okListener != null) {
627             okButton.addActionListener(okListener);
628         }
629         okButton.addActionListener(new ActionListener() {
630             public void actionPerformed(ActionEvent e) {
631                 hide();
632             }
633         });
634         buttonPane.add(okButton);
635
636         cancelButton = new JButton JavaDoc(cancelString);
637
638     // The following few lines are used to register esc to close the dialog
639
Action JavaDoc cancelKeyAction = new AbstractAction JavaDoc() {
640             public void actionPerformed(ActionEvent e) {
641                 ((AbstractButton JavaDoc)e.getSource()).fireActionPerformed(e);
642             }
643         };
644     KeyStroke JavaDoc cancelKeyStroke = KeyStroke.getKeyStroke((char)KeyEvent.VK_ESCAPE, false);
645     InputMap JavaDoc inputMap = cancelButton.getInputMap(JComponent.
646                              WHEN_IN_FOCUSED_WINDOW);
647     ActionMap JavaDoc actionMap = cancelButton.getActionMap();
648     if (inputMap != null && actionMap != null) {
649         inputMap.put(cancelKeyStroke, "cancel");
650         actionMap.put("cancel", cancelKeyAction);
651     }
652     // end esc handling
653

654         cancelButton.setActionCommand("cancel");
655         if (cancelListener != null) {
656             cancelButton.addActionListener(cancelListener);
657         }
658         cancelButton.addActionListener(new ActionListener() {
659             public void actionPerformed(ActionEvent e) {
660                 hide();
661             }
662         });
663         buttonPane.add(cancelButton);
664
665         JButton JavaDoc resetButton = new JButton JavaDoc(resetString);
666         resetButton.addActionListener(new ActionListener() {
667            public void actionPerformed(ActionEvent e) {
668                reset();
669            }
670         });
671         int mnemonic = UIManager.getInt("ColorChooser.resetMnemonic", -1);
672         if (mnemonic != -1) {
673             resetButton.setMnemonic(mnemonic);
674         }
675         buttonPane.add(resetButton);
676         contentPane.add(buttonPane, BorderLayout.SOUTH);
677
678         if (JDialog.isDefaultLookAndFeelDecorated()) {
679             boolean supportsWindowDecorations =
680             UIManager.getLookAndFeel().getSupportsWindowDecorations();
681             if (supportsWindowDecorations) {
682                 getRootPane().setWindowDecorationStyle(JRootPane.COLOR_CHOOSER_DIALOG);
683             }
684         }
685         applyComponentOrientation(((c == null) ? getRootPane() : c).getComponentOrientation());
686
687         pack();
688         setLocationRelativeTo(c);
689
690         this.addWindowListener(new Closer());
691         this.addComponentListener(new DisposeOnClose());
692     }
693
694     public void show() {
695         initialColor = chooserPane.getColor();
696         super.show();
697     }
698
699     public void reset() {
700         chooserPane.setColor(initialColor);
701     }
702
703     class Closer extends WindowAdapter implements Serializable{
704         public void windowClosing(WindowEvent e) {
705             cancelButton.doClick(0);
706             Window w = e.getWindow();
707             w.hide();
708         }
709     }
710
711     static class DisposeOnClose extends ComponentAdapter implements Serializable{
712         public void componentHidden(ComponentEvent e) {
713             Window w = (Window)e.getComponent();
714             w.dispose();
715         }
716     }
717
718 }
719
720 class ColorTracker implements ActionListener, Serializable {
721     JColorChooser JavaDoc chooser;
722     Color color;
723
724     public ColorTracker(JColorChooser JavaDoc c) {
725         chooser = c;
726     }
727
728     public void actionPerformed(ActionEvent e) {
729         color = chooser.getColor();
730     }
731
732     public Color getColor() {
733         return color;
734     }
735 }
736
737
Popular Tags