本文整理汇总了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);
}
示例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();
}
});
}
示例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();
}
}
}
示例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);
}
}
示例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);
}
}
示例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)));
}
示例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();
}
});
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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());
}
}