Class JColorChooser

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class JColorChooser extends JComponent implements Accessible
Emulator for JColorChooser. R_leaf_peer_lockdown-locked peer is SJColorChooser.
See Also:
  • Field Details

  • Constructor Details

    • JColorChooser

      public JColorChooser()
    • JColorChooser

      public JColorChooser(Color initialColor)
    • JColorChooser

      public JColorChooser(ColorSelectionModel model)
      Throws:
      NullPointerException - if model is null, as the JDK's L&F install does
  • Method Details

    • getColor

      public Color getColor()
    • setColor

      public void setColor(Color color)
    • setColor

      public void setColor(int r, int g, int b)
    • setColor

      public void setColor(int c)
    • getSelectionModel

      public ColorSelectionModel getSelectionModel()
    • setSelectionModel

      public void setSelectionModel(ColorSelectionModel newModel)
      Throws:
      NullPointerException - if newModel is null — after storing it and before the event, as the JDK's L&F listener does when it moves its model listener
    • getDragEnabled

      public boolean getDragEnabled()
    • setDragEnabled

      public void setDragEnabled(boolean b)
      Stored, and drives nothing: the native color input has no drag-out. The JDK's HeadlessException is not thrown, since a browser is not headless.
    • getPreviewPanel

      public JComponent getPreviewPanel()
      null until one is set: the JDK's L&F installs a DefaultPreviewPanel, a javax.swing component this type cannot hold.
    • setPreviewPanel

      public void setPreviewPanel(JComponent preview)
      Stores the panel and fires previewPanel; the panel itself is never rendered (the native colour input has no preview slot).

      Typed JComponent per R_no_vaadin_in_api limb 1 — with the JDK's type a migrated JPanel could not be passed at all. R_decline_effect_only owes the state and the event, and declines only the effect.

    • addChooserPanel

      public void addChooserPanel(AbstractColorChooserPanel panel)
    • removeChooserPanel

      public AbstractColorChooserPanel removeChooserPanel(AbstractColorChooserPanel panel)
      Throws:
      IllegalArgumentException - if panel is not one of this chooser's
    • setChooserPanels

      public void setChooserPanels(AbstractColorChooserPanel[] panels)
      Stores a copy and fires chooserPanels; the panels are never rendered, since the native color input is the chooser UI. The panels' installChooserPanel hook is not called: it takes a javax.swing.JColorChooser, which this is not.
      Throws:
      NullPointerException - if panels or one of its elements is null — an element after storing the array and before the event, as the JDK's L&F listener does
    • getChooserPanels

      public AbstractColorChooserPanel[] getChooserPanels()
    • showDialog

      public static Color showDialog(Component parent, String title, Color initialColor)
    • showDialog

      public static Color showDialog(Component parent, String title, Color initialColor, boolean colorTransparencySelectionEnabled)
    • createDialog

      public static JDialog createDialog(Component parent, String title, boolean modal, JColorChooser chooserPane, ActionListener okListener, ActionListener cancelListener)
      JDK-shaped createDialog: returns a non-blocking JDialog the caller wires and shows itself. The two ActionListeners fire on OK / Cancel respectively (JDK semantics); both dispose the dialog.
    • paramString

      protected String paramString()
      Overrides:
      paramString in class JComponent
    • updateUI

      public void updateUI()
      Overrides:
      updateUI in class JComponent
    • getUIClassID

      public String getUIClassID()
      Overrides:
      getUIClassID in class JComponent
    • getUI

      public ColorChooserUI getUI()
      Overrides:
      getUI in class JComponent
    • setUI

      public void setUI(ColorChooserUI ui)
    • getAccessibleContext

      public AccessibleContext getAccessibleContext()
      Specified by:
      getAccessibleContext in interface Accessible
      Overrides:
      getAccessibleContext in class Component