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


Java ColorPicker.GREEN属性代码示例

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

示例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);
}
 
开发者ID:OSUCartography,项目名称:TerrainViewer,代码行数:52,代码来源:ColorPickerSliderUI.java


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