本文整理汇总了Java中com.bric.swing.ColorPicker.GREEN属性的典型用法代码示例。如果您正苦于以下问题:Java ColorPicker.GREEN属性的具体用法?Java ColorPicker.GREEN怎么用?Java ColorPicker.GREEN使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.bric.swing.ColorPicker
的用法示例。
在下文中一共展示了ColorPicker.GREEN属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paintTrack
@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);
}
示例2: paintTrack
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);
}