public void testSetGetPreviewPanel() throws Exception { ch.addPropertyChangeListener(propertyChangeController); assertNotNull(ch.getPreviewPanel()); JButton button = new JButton(); ch.setPreviewPanel(button); assertTrue(propertyChangeController.isChanged(JColorChooser.PREVIEW_PANEL_PROPERTY)); assertSame(button, ch.getPreviewPanel()); assertSame(button, ((PropertyChangeEvent) propertyChangeController.getLastEvent()) .getNewValue()); propertyChangeController.reset(); ch.setPreviewPanel(null); assertTrue(propertyChangeController.isChanged(JColorChooser.PREVIEW_PANEL_PROPERTY)); assertNotNull(ch.getPreviewPanel()); assertSame(ColorChooserComponentFactory.getPreviewPanel().getClass(), ch .getPreviewPanel().getClass()); }
public void setPreviewPanel(JComponent preview) { JComponent oldValue = previewPanel; if (preview == null) { previewPanel = ColorChooserComponentFactory.getPreviewPanel(); } else { previewPanel = preview; } firePropertyChange(PREVIEW_PANEL_PROPERTY, oldValue, previewPanel); }
protected void installPreviewPanel() { if (chooser.getPreviewPanel() == null) { chooser.setPreviewPanel(ColorChooserComponentFactory.getPreviewPanel()); chooser.getPreviewPanel().setForeground(model.getSelectedColor()); return; } previewPanel.removeAll(); previewPanel.add(chooser.getPreviewPanel()); previewPanel.setBorder(BorderFactory.createTitledBorder(UIManager.getString("ColorChooser.previewText"))); if (previewPanel.getParent() == null) { chooser.add(previewPanel, BorderLayout.SOUTH); } }
/** * This method installs the preview panel for the JColorChooser. */ protected void installPreviewPanel() { updatePreviewPanel(ColorChooserComponentFactory.getPreviewPanel()); }
protected AbstractColorChooserPanel[] createDefaultChoosers() { return ColorChooserComponentFactory.getDefaultChooserPanels(); }
/** * This method creates the default chooser panels for the JColorChooser. * * @return The default chooser panels. */ protected AbstractColorChooserPanel[] createDefaultChoosers() { return ColorChooserComponentFactory.getDefaultChooserPanels(); }