jdk/src/share/classes/javax/swing/JColorChooser.java
changeset 23697 e556a715949f
parent 22574 7f8ce0c8c20a
child 24969 afa6934dd8e8
equal deleted inserted replaced
23696:7deff68428ef 23697:e556a715949f
   604  * Class which builds a color chooser dialog consisting of
   604  * Class which builds a color chooser dialog consisting of
   605  * a JColorChooser with "Ok", "Cancel", and "Reset" buttons.
   605  * a JColorChooser with "Ok", "Cancel", and "Reset" buttons.
   606  *
   606  *
   607  * Note: This needs to be fixed to deal with localization!
   607  * Note: This needs to be fixed to deal with localization!
   608  */
   608  */
       
   609 @SuppressWarnings("serial") // Superclass is not serializable across versions
   609 class ColorChooserDialog extends JDialog {
   610 class ColorChooserDialog extends JDialog {
   610     private Color initialColor;
   611     private Color initialColor;
   611     private JColorChooser chooserPane;
   612     private JColorChooser chooserPane;
   612     private JButton cancelButton;
   613     private JButton cancelButton;
   613 
   614 
   663 
   664 
   664         cancelButton = new JButton(cancelString);
   665         cancelButton = new JButton(cancelString);
   665         cancelButton.getAccessibleContext().setAccessibleDescription(cancelString);
   666         cancelButton.getAccessibleContext().setAccessibleDescription(cancelString);
   666 
   667 
   667         // The following few lines are used to register esc to close the dialog
   668         // The following few lines are used to register esc to close the dialog
       
   669         @SuppressWarnings("serial") // anonymous class
   668         Action cancelKeyAction = new AbstractAction() {
   670         Action cancelKeyAction = new AbstractAction() {
   669             public void actionPerformed(ActionEvent e) {
   671             public void actionPerformed(ActionEvent e) {
   670                 ((AbstractButton)e.getSource()).fireActionPerformed(e);
   672                 ((AbstractButton)e.getSource()).fireActionPerformed(e);
   671             }
   673             }
   672         };
   674         };
   727 
   729 
   728     public void reset() {
   730     public void reset() {
   729         chooserPane.setColor(initialColor);
   731         chooserPane.setColor(initialColor);
   730     }
   732     }
   731 
   733 
       
   734     @SuppressWarnings("serial") // JDK-implementation class
   732     class Closer extends WindowAdapter implements Serializable{
   735     class Closer extends WindowAdapter implements Serializable{
   733         public void windowClosing(WindowEvent e) {
   736         public void windowClosing(WindowEvent e) {
   734             cancelButton.doClick(0);
   737             cancelButton.doClick(0);
   735             Window w = e.getWindow();
   738             Window w = e.getWindow();
   736             w.hide();
   739             w.hide();
   737         }
   740         }
   738     }
   741     }
   739 
   742 
       
   743     @SuppressWarnings("serial") // JDK-implementation class
   740     static class DisposeOnClose extends ComponentAdapter implements Serializable{
   744     static class DisposeOnClose extends ComponentAdapter implements Serializable{
   741         public void componentHidden(ComponentEvent e) {
   745         public void componentHidden(ComponentEvent e) {
   742             Window w = (Window)e.getComponent();
   746             Window w = (Window)e.getComponent();
   743             w.dispose();
   747             w.dispose();
   744         }
   748         }
   745     }
   749     }
   746 
   750 
   747 }
   751 }
   748 
   752 
       
   753 @SuppressWarnings("serial") // JDK-implementation class
   749 class ColorTracker implements ActionListener, Serializable {
   754 class ColorTracker implements ActionListener, Serializable {
   750     JColorChooser chooser;
   755     JColorChooser chooser;
   751     Color color;
   756     Color color;
   752 
   757 
   753     public ColorTracker(JColorChooser c) {
   758     public ColorTracker(JColorChooser c) {