Methods Summary |
---|
protected javax.swing.colorchooser.AbstractColorChooserPanel[] | createDefaultChoosers()
AbstractColorChooserPanel[] panels = ColorChooserComponentFactory.getDefaultChooserPanels();
return panels;
|
protected java.beans.PropertyChangeListener | createPropertyChangeListener()
return getHandler();
|
public static javax.swing.plaf.ComponentUI | createUI(javax.swing.JComponent c)
return new BasicColorChooserUI();
|
private javax.swing.plaf.basic.BasicColorChooserUI$Handler | getHandler()
if (handler == null) {
handler = new Handler();
}
return handler;
|
protected void | installDefaults()
LookAndFeel.installColorsAndFont(chooser, "ColorChooser.background",
"ColorChooser.foreground",
"ColorChooser.font");
LookAndFeel.installProperty(chooser, "opaque", Boolean.TRUE);
TransferHandler th = chooser.getTransferHandler();
if (th == null || th instanceof UIResource) {
chooser.setTransferHandler(defaultTransferHandler);
}
|
protected void | installListeners()
propertyChangeListener = createPropertyChangeListener();
chooser.addPropertyChangeListener( propertyChangeListener );
previewListener = getHandler();
chooser.getSelectionModel().addChangeListener(previewListener);
|
protected void | installPreviewPanel()
if (previewPanel != null) {
previewPanelHolder.remove(previewPanel);
previewPanel.removeMouseListener(getHandler());
}
previewPanel = chooser.getPreviewPanel();
Dimension layoutSize = new Dimension(); // fix for bug 4759306
if (previewPanel != null) {
layoutSize = new BorderLayout().minimumLayoutSize(previewPanel);
if ((previewPanelHolder != null) && (chooser != null) &&
(layoutSize.getWidth() + layoutSize.getHeight() == 0)) {
chooser.remove(previewPanelHolder);
return;
}
}
if (previewPanel == null || previewPanel instanceof UIResource) {
previewPanel = ColorChooserComponentFactory.getPreviewPanel(); // get from table?
chooser.setPreviewPanel(previewPanel);
}
previewPanel.setForeground(chooser.getColor());
previewPanelHolder.add(previewPanel);
previewPanel.addMouseListener(getHandler());
|
public void | installUI(javax.swing.JComponent c)
chooser = (JColorChooser)c;
super.installUI( c );
installDefaults();
installListeners();
tabbedPane = new JTabbedPane();
tabbedPane.setName("ColorChooser.tabPane");
singlePanel = new JPanel(new CenterLayout());
singlePanel.setName("ColorChooser.panel");
chooser.setLayout( new BorderLayout() );
defaultChoosers = createDefaultChoosers();
chooser.setChooserPanels(defaultChoosers);
previewPanelHolder = new JPanel(new CenterLayout());
previewPanelHolder.setName("ColorChooser.previewPanelHolder");
if (DefaultLookup.getBoolean(chooser, this,
"ColorChooser.showPreviewPanelText", true)) {
String previewString = UIManager.getString(
"ColorChooser.previewText", chooser.getLocale());
previewPanelHolder.setBorder(new TitledBorder(previewString));
}
chooser.add(previewPanelHolder, BorderLayout.SOUTH);
installPreviewPanel();
chooser.applyComponentOrientation(c.getComponentOrientation());
|
protected void | uninstallDefaultChoosers()
AbstractColorChooserPanel[] choosers = chooser.getChooserPanels();
for( int i = 0 ; i < choosers.length; i++) {
chooser.removeChooserPanel( choosers[i] );
}
|
protected void | uninstallDefaults()
if (chooser.getTransferHandler() instanceof UIResource) {
chooser.setTransferHandler(null);
}
|
protected void | uninstallListeners()
chooser.removePropertyChangeListener( propertyChangeListener );
chooser.getSelectionModel().removeChangeListener(previewListener);
previewPanel.removeMouseListener(getHandler());
|
public void | uninstallUI(javax.swing.JComponent c)
chooser.remove(tabbedPane);
chooser.remove(singlePanel);
chooser.remove(previewPanelHolder);
uninstallDefaultChoosers();
uninstallListeners();
uninstallDefaults();
previewPanelHolder.remove(previewPanel);
if (previewPanel instanceof UIResource) {
chooser.setPreviewPanel(null);
}
previewPanelHolder = null;
previewPanel = null;
defaultChoosers = null;
chooser = null;
tabbedPane = null;
handler = null;
|