本文整理汇总了Java中org.jdesktop.swingx.color.EyeDropperColorChooserPanel类的典型用法代码示例。如果您正苦于以下问题:Java EyeDropperColorChooserPanel类的具体用法?Java EyeDropperColorChooserPanel怎么用?Java EyeDropperColorChooserPanel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EyeDropperColorChooserPanel类属于org.jdesktop.swingx.color包,在下文中一共展示了EyeDropperColorChooserPanel类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PaintPicker
import org.jdesktop.swingx.color.EyeDropperColorChooserPanel; //导入依赖的package包/类
/** Creates new form PaintPicker */
public PaintPicker() {
initComponents();
// set up the color picker
lastPickerUsed = colorPicker;
colorPicker.addChooserPanel(new EyeDropperColorChooserPanel());
ColorListener colorListener = new ColorListener();
colorPicker.getSelectionModel().addChangeListener(colorListener);
alphaSlider.addChangeListener(colorListener);
// set up the gradient picker
gradientPicker = new JXGradientChooser();
tabbedPane.addTab("Gradient",gradientPicker);
gradientPicker.addPropertyChangeListener("gradient",new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
lastPickerUsed = gradientPicker;
setPaint(gradientPicker.getGradient());
}
});
// update when the tabs change
tabbedPane.getModel().addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent changeEvent) {
lastPickerUsed = tabbedPane.getSelectedComponent();
Paint old = selectedPaint;
if(lastPickerUsed == colorPickerParent) {
selectedPaint = colorPicker.getSelectionModel().getSelectedColor();
}
if(lastPickerUsed == gradientPicker) {
selectedPaint = gradientPicker.getGradient();
}
firePropertyChange("paint",old,selectedPaint);
}
});
}
示例2: getChooser
import org.jdesktop.swingx.color.EyeDropperColorChooserPanel; //导入依赖的package包/类
/**
* Get the JColorChooser that is used by this JXColorSelectionButton. This
* chooser instance is shared between all invocations of the chooser, but is unique to
* this instance of JXColorSelectionButton.
* @return the JColorChooser used by this JXColorSelectionButton
*/
public JColorChooser getChooser() {
if(chooser == null) {
chooser = new JColorChooser();
// add the eyedropper color chooser panel
chooser.addChooserPanel(new EyeDropperColorChooserPanel());
}
return chooser;
}