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


Java ColorPicker类代码示例

本文整理汇总了Java中com.bric.swing.ColorPicker的典型用法代码示例。如果您正苦于以下问题:Java ColorPicker类的具体用法?Java ColorPicker怎么用?Java ColorPicker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ColorPicker类属于com.bric.swing包,在下文中一共展示了ColorPicker类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: NeonBorderEffectConfiguratorPanel

import com.bric.swing.ColorPicker; //导入依赖的package包/类
NeonBorderEffectConfiguratorPanel(boolean defaultSelected, Color defaultColor, Color innerColor, int defaultWidth) {
    super("Neon Border", defaultSelected, defaultColor, defaultWidth);

    this.innerColor = innerColor;
    innerColorSwatch = new ColorSwatch(this.innerColor, BUTTON_SIZE);

    innerColorSwatch.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            Color selectedColor = ColorPicker.showDialog(PixelitorWindow.getInstance(), "Select Color", NeonBorderEffectConfiguratorPanel.this.innerColor, true);
            if (selectedColor != null) { // ok was pressed
                NeonBorderEffectConfiguratorPanel.this.innerColor = selectedColor;
                innerColorSwatch.setForeground(NeonBorderEffectConfiguratorPanel.this.innerColor);
                innerColorSwatch.paintImmediately(0, 0, BUTTON_SIZE, BUTTON_SIZE);

                if (adjustmentListener != null) {
                    adjustmentListener.paramAdjusted();
                }
            }
        }
    });

    gbHelper.addLabelWithControl("Inner Color:", innerColorSwatch);
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:25,代码来源:NeonBorderEffectConfiguratorPanel.java

示例2: ColorPickerSliderUI

import com.bric.swing.ColorPicker; //导入依赖的package包/类
public ColorPickerSliderUI(JSlider b,ColorPicker cp) {
	super(b);
	colorPicker = cp;
	cp.getColorPanel().addComponentListener(new ComponentAdapter() {
		@Override
		public void componentResized(ComponentEvent e) {
			ColorPickerSliderUI.this.calculateGeometry();
			slider.repaint();
		}
	});
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:12,代码来源:ColorPickerSliderUI.java

示例3: changeColor

import com.bric.swing.ColorPicker; //导入依赖的package包/类
private void changeColor() {
    Color selectedColor = ColorPicker.showDialog(PixelitorWindow.getInstance(), "Select Color", color, true);
    if (selectedColor != null) { // ok was pressed
        color = selectedColor;
        colorSwatch.setForeground(color);
        colorSwatch.paintImmediately(0, 0, BUTTON_SIZE, BUTTON_SIZE);

        if (adjustmentListener != null) {
            adjustmentListener.paramAdjusted();
        }
    }
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:13,代码来源:EffectConfiguratorPanel.java

示例4: showColorDialog

import com.bric.swing.ColorPicker; //导入依赖的package包/类
private void showColorDialog() {
//        Color color = JColorChooser.showDialog(this, "Select Color", model.getColor());

        Color color = ColorPicker.showDialog(PixelitorWindow.getInstance(), "Select " + model.getName(), model.getColor(), model.allowOpacity());

        if (color != null) { // ok was pressed
//            button.setBackground(color);
//            button.paintImmediately(0, 0, BUTTON_SIZE, BUTTON_SIZE);

            colorSwatch.setForeground(color);
            colorSwatch.paintImmediately(0, 0, BUTTON_SIZE, BUTTON_SIZE);

            model.setColor(color, true);
        }
    }
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:16,代码来源:ColorSelector.java

示例5: selectColor

import com.bric.swing.ColorPicker; //导入依赖的package包/类
protected void selectColor() {
  java.awt.Color selectedColor = ColorPicker.showDialog(MainWindow.current, Utils.fromLibgdx(color));
  Color oldColor               = new Color(color);
  if (selectedColor != null) {
    Color newColor = Utils.fromAwt(selectedColor);

    colorEditor.setColor(newColor);
    firePropertyChange(oldColor, newColor);
  }
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:11,代码来源:ColorEditor.java

示例6: jColorChooserActionPerformed

import com.bric.swing.ColorPicker; //导入依赖的package包/类
private void jColorChooserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jColorChooserActionPerformed
    ColorPicker picker = new ColorPicker();
    picker.setColor(Color.WHITE);
    picker.setOpacityVisible(false);
    JOptionPane.showMessageDialog(null, picker, AppLocal.getIntString("dialog.ColorPicker"), JOptionPane.PLAIN_MESSAGE);
    Color newColor = picker.getColor();
    String sColor = "0x" + Integer.toHexString(0x100 | newColor.getRed()).substring(1).toUpperCase()
            + Integer.toHexString(0x100 | newColor.getGreen()).substring(1).toUpperCase()
            + Integer.toHexString(0x100 | newColor.getBlue()).substring(1).toUpperCase();
    m_jColor.setText(sColor);

    m_jColor.setBackground(new Color((int) Integer.decode(sColor)));
}
 
开发者ID:nordpos,项目名称:nordpos,代码行数:14,代码来源:LayersEditor.java

示例7: ColorPickerSliderUI

import com.bric.swing.ColorPicker; //导入依赖的package包/类
public ColorPickerSliderUI(JSlider b,ColorPicker cp) {
	super(b);
	colorPicker = cp;
	cp.getColorPanel().addComponentListener(new ComponentAdapter() {
		public void componentResized(ComponentEvent e) {
			ColorPickerSliderUI.this.calculateGeometry();
			slider.repaint();
		}
	});
}
 
开发者ID:OSUCartography,项目名称:TerrainViewer,代码行数:11,代码来源:ColorPickerSliderUI.java

示例8: backgroundColorMenuItemActionPerformed

import com.bric.swing.ColorPicker; //导入依赖的package包/类
private void backgroundColorMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backgroundColorMenuItemActionPerformed

    Color bc = map3DViewer.getBackgroundColor();
    bc = ColorPicker.showDialog(this, "Background Color", bc, false);
    if (bc != null) {
        map3DViewer.setBackgroundColor(bc);
    }
}
 
开发者ID:OSUCartography,项目名称:TerrainViewer,代码行数:9,代码来源:MainWindow.java

示例9: paintTrack

import com.bric.swing.ColorPicker; //导入依赖的package包/类
@Override
public synchronized void paintTrack(Graphics g) {
	int mode = colorPicker.getMode();
	if(mode==ColorPicker.HUE || mode==ColorPicker.BRI || mode==ColorPicker.SAT) {
		float[] hsb = colorPicker.getHSB();
		if(mode==ColorPicker.HUE) {
			for(int y = 0; y<trackRect.height; y++) {
				float hue = ((float)y)/((float)trackRect.height);
				intArray[y] = Color.HSBtoRGB( hue, 1, 1);
			}
		} else if(mode==ColorPicker.SAT) {
			for(int y = 0; y<trackRect.height; y++) {
				float sat = 1-((float)y)/((float)trackRect.height);
				intArray[y] = Color.HSBtoRGB( hsb[0], sat, hsb[2]);
			}
		} else {
			for(int y = 0; y<trackRect.height; y++) {
				float bri = 1-((float)y)/((float)trackRect.height);
				intArray[y] = Color.HSBtoRGB( hsb[0], hsb[1], bri);
			}
		}
	} else {
		int[] rgb = colorPicker.getRGB();
		if(mode==ColorPicker.RED) {
			for(int y = 0; y<trackRect.height; y++) {
				int red = 255-(int)(y*255/trackRect.height+.49);
				intArray[y] = (red << 16)+(rgb[1] << 8)+(rgb[2]);
			}
		} else if(mode==ColorPicker.GREEN) {
			for(int y = 0; y<trackRect.height; y++) {
				int green = 255-(int)(y*255/trackRect.height+.49);
				intArray[y] = (rgb[0] << 16)+(green << 8)+(rgb[2]);
			}
		} else if(mode==ColorPicker.BLUE) {
			for(int y = 0; y<trackRect.height; y++) {
				int blue = 255-(int)(y*255/trackRect.height+.49);
				intArray[y] = (rgb[0] << 16)+(rgb[1] << 8)+(blue);
			}
		}
	}
	Graphics2D g2 = (Graphics2D)g;
	Rectangle r = new Rectangle(6, trackRect.y, 14, trackRect.height);
	if(slider.hasFocus()) {
		PlafPaintUtils.paintFocus(g2,r,3);
	}
	
	bi.getRaster().setDataElements(0,0,1,trackRect.height,intArray);
	TexturePaint p = new TexturePaint(bi,new Rectangle(0,trackRect.y,1,bi.getHeight()));
	g2.setPaint(p);
	g2.fillRect(r.x,r.y,r.width,r.height);
	
	PlafPaintUtils.drawBevel(g2, r);
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:54,代码来源:ColorPickerSliderUI.java

示例10: bgButtonPressed

import com.bric.swing.ColorPicker; //导入依赖的package包/类
private void bgButtonPressed() {
    Color c = ColorPicker.showDialog(PixelitorWindow.getInstance(), "Set background color", bgColor, false);
    if (c != null) {
        setBgColor(c);
    }
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:7,代码来源:FgBgColorSelector.java

示例11: fgButtonPressed

import com.bric.swing.ColorPicker; //导入依赖的package包/类
private void fgButtonPressed() {
    Color c = ColorPicker.showDialog(PixelitorWindow.getInstance(), "Set foreground color", fgColor, false);
    if (c != null) {
        setFgColor(c);
    }
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:7,代码来源:FgBgColorSelector.java

示例12: paintTrack

import com.bric.swing.ColorPicker; //导入依赖的package包/类
public synchronized void paintTrack(Graphics g) {
	int mode = colorPicker.getMode();
	if(mode==ColorPicker.HUE || mode==ColorPicker.BRI || mode==ColorPicker.SAT) {
		float[] hsb = colorPicker.getHSB();
		if(mode==ColorPicker.HUE) {
			for(int y = 0; y<trackRect.height; y++) {
				float hue = ((float)y)/((float)trackRect.height);
				intArray[y] = Color.HSBtoRGB( hue, 1, 1);
			}
		} else if(mode==ColorPicker.SAT) {
			for(int y = 0; y<trackRect.height; y++) {
				float sat = 1-((float)y)/((float)trackRect.height);
				intArray[y] = Color.HSBtoRGB( hsb[0], sat, hsb[2]);
			}
		} else {
			for(int y = 0; y<trackRect.height; y++) {
				float bri = 1-((float)y)/((float)trackRect.height);
				intArray[y] = Color.HSBtoRGB( hsb[0], hsb[1], bri);
			}
		}
	} else {
		int[] rgb = colorPicker.getRGB();
		if(mode==ColorPicker.RED) {
			for(int y = 0; y<trackRect.height; y++) {
				int red = 255-(int)(y*255/trackRect.height+.49);
				intArray[y] = (red << 16)+(rgb[1] << 8)+(rgb[2]);
			}
		} else if(mode==ColorPicker.GREEN) {
			for(int y = 0; y<trackRect.height; y++) {
				int green = 255-(int)(y*255/trackRect.height+.49);
				intArray[y] = (rgb[0] << 16)+(green << 8)+(rgb[2]);
			}
		} else if(mode==ColorPicker.BLUE) {
			for(int y = 0; y<trackRect.height; y++) {
				int blue = 255-(int)(y*255/trackRect.height+.49);
				intArray[y] = (rgb[0] << 16)+(rgb[1] << 8)+(blue);
			}
		}
	}
	Graphics2D g2 = (Graphics2D)g;
	Rectangle r = new Rectangle(6, trackRect.y, 14, trackRect.height);
	if(slider.hasFocus()) {
		PaintUtils.paintFocus(g2,r,3);
	}
	
	bi.getRaster().setDataElements(0,0,1,trackRect.height,intArray);
	TexturePaint p = new TexturePaint(bi,new Rectangle(0,trackRect.y,1,bi.getHeight()));
	g2.setPaint(p);
	g2.fillRect(r.x,r.y,r.width,r.height);
	
	PaintUtils.drawBevel(g2, r);
}
 
开发者ID:OSUCartography,项目名称:TerrainViewer,代码行数:53,代码来源:ColorPickerSliderUI.java

示例13: fogColorButtonPropertyChange

import com.bric.swing.ColorPicker; //导入依赖的package包/类
private void fogColorButtonPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_fogColorButtonPropertyChange
    if (ColorPicker.SELECTED_COLOR_PROPERTY.equals(evt.getPropertyName())) {
        this.map3DViewer.setFogColor((Color) evt.getNewValue());
    }
}
 
开发者ID:OSUCartography,项目名称:TerrainViewer,代码行数:6,代码来源:Map3DOptionsPanel.java


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