当前位置: 首页>>代码示例>>Java>>正文


Java EyeDropperColorChooserPanel类代码示例

本文整理汇总了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);
        }
    });
    
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:38,代码来源:PaintPicker.java

示例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;
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:15,代码来源:JXColorSelectionButton.java


注:本文中的org.jdesktop.swingx.color.EyeDropperColorChooserPanel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。