本文整理汇总了Java中java.awt.Color.white方法的典型用法代码示例。如果您正苦于以下问题:Java Color.white方法的具体用法?Java Color.white怎么用?Java Color.white使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Color
的用法示例。
在下文中一共展示了Color.white方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addPoint
import java.awt.Color; //导入方法依赖的package包/类
/**
* Add a new control point
*/
private void addPoint() {
ControlPoint point = new ControlPoint(Color.white, 0.5f);
for (int i=0;i<list.size()-1;i++) {
ControlPoint now = (ControlPoint) list.get(i);
ControlPoint next = (ControlPoint) list.get(i+1);
if ((now.pos <= 0.5f) && (next.pos >=0.5f)) {
list.add(i+1,point);
break;
}
}
selected = point;
sortPoints();
repaint(0);
fireUpdate();
}
示例2: createComponentImage
import java.awt.Color; //导入方法依赖的package包/类
protected static BufferedImage createComponentImage(int w, int h,
ComponentColorModel cm)
{
WritableRaster wr = cm.createCompatibleWritableRaster(w, h);
BufferedImage img = new BufferedImage(cm, wr, false, null);
Graphics2D g = img.createGraphics();
int width = w / 8;
Color[] colors = new Color[8];
colors[0] = Color.red;
colors[1] = Color.green;
colors[2] = Color.blue;
colors[3] = Color.white;
colors[4] = Color.black;
colors[5] = new Color(0x80, 0x80, 0x80, 0x00);
colors[6] = Color.yellow;
colors[7] = Color.cyan;
for (int i = 0; i < 8; i++) {
g.setColor(colors[i]);
g.fillRect(i * width, 0, width, h);
}
return img;
}
示例3: generate
import java.awt.Color; //导入方法依赖的package包/类
public static BufferedImage generate(String name, String email) throws NoSuchAlgorithmException {
Long index = getColorIndex(email);
String family;
if (Holder.ALL_FONT_FAMILIES.contains(DEFAULT_FONT)) {
family = DEFAULT_FONT;
} else {
family = Font.MONOSPACED;
}
Color background = COLORS[index.intValue()];
Color foreground = Color.white;
return generate(
DEFAULT_WIDTH,
DEFAULT_HEIGHT,
name,
family,
background,
foreground);
}
示例4: print
import java.awt.Color; //导入方法依赖的package包/类
/**
* Redraws the terminal in a way suitable for printing on a printer.
* This is designed to be used as part of a print chain; that is, it
* can be wrapped by other .print methods specified via printchain.
* @param g The graphics to print on.
* @param printchain The
*/
public void print(Graphics g, Printable printchain) {
if (debug > 0) {
System.err.println("DEBUG: print()");
}
for (int i = 0; i <= buffer.height; i++) {
update[i] = true;
}
Color[] colorSave = null;
if (!colorPrinting) {
colorSave = color;
color = new Color[]{Color.black, Color.black, Color.black, Color.black, Color.black, Color.black, Color.black, Color.white, null, null, Color.black, Color.black, Color.black, Color.black, Color.black, Color.black, Color.black, Color.white};
}
printchain.print(g);
if (!colorPrinting) {
color = colorSave;
}
}
示例5: doPaint
import java.awt.Color; //导入方法依赖的package包/类
public void doPaint(Graphics2D g2d) {
g2d.translate(DIM*0.2, DIM*0.2);
Shape s = new Rectangle2D.Float(0, 0, DIM*2, DIM*2);
Point2D.Double p1 = new Point2D.Double(0.0, 0.0);
Point2D.Double p2 = new Point2D.Double(DIM/2.0, DIM/2.0);
// LinearGradientPaint
//g2d.translate(DIM*2.2, 0);
Color colors[] = { Color.red, Color.blue} ;
float fractions[] = { 0.0f, 1.0f };
LinearGradientPaint lgp =
new LinearGradientPaint(p1, p2, fractions, colors,
LinearGradientPaint.CycleMethod.NO_CYCLE);
g2d.setPaint(lgp);
g2d.fill(s);
g2d.translate(DIM*2.2, 0);
Color colors1[] = { Color.red, Color.blue, Color.green, Color.white} ;
float fractions1[] = { 0.0f, 0.3f, 0.6f, 1.0f };
LinearGradientPaint lgp1 =
new LinearGradientPaint(p1, p2, fractions1, colors1,
LinearGradientPaint.CycleMethod.REFLECT);
g2d.setPaint(lgp1);
g2d.fill(s);
g2d.translate(-DIM*2.2, DIM*2.2);
Color colors2[] = { Color.red, Color.blue, Color.green, Color.white} ;
float fractions2[] = { 0.0f, 0.3f, 0.6f, 1.0f };
LinearGradientPaint lgp2 =
new LinearGradientPaint(p1, p2, fractions2, colors2,
LinearGradientPaint.CycleMethod.REPEAT);
g2d.setPaint(lgp2);
g2d.fill(s);
}
示例6: getNodeColor
import java.awt.Color; //导入方法依赖的package包/类
public Color getNodeColor(int nodeID) {
boolean c = collapsedNodes.contains(nodeID);
boolean a = collapsedAttributes.contains(nodeID);
if (c) {
if (a)
return Color.green;
return Color.yellow;
}
if (a)
return Color.cyan;
return Color.white;
}
示例7: getFormDesignerBackgroundColor
import java.awt.Color; //导入方法依赖的package包/类
/**
* Getter for the formDesignerBackgroundColor option.
*
* @return background color of the designer.
*/
public java.awt.Color getFormDesignerBackgroundColor() {
Color defaultBackground = UIManager.getColor( "Tree.background" ); //NOI18N
if( null == defaultBackground )
defaultBackground = Color.white;
int rgb = getPreferences().getInt(PROP_FORMDESIGNER_BACKGROUND_COLOR , defaultBackground.getRGB());
return new Color(rgb);
}
示例8: randomColor
import java.awt.Color; //导入方法依赖的package包/类
private Color randomColor() {
Color colors[] = {Color.black, Color.blue, Color.cyan,
Color.gray, Color.darkGray, Color.green,
Color.lightGray, Color.magenta, Color.orange,
Color.pink,Color.red, Color.white, Color.yellow};
return colors[(int)(Math.random() * colors.length)];
}
示例9: setSelectedNodes
import java.awt.Color; //导入方法依赖的package包/类
public void setSelectedNodes(Set<Integer> nodes) {
this.selectedNodes = nodes;
List<Color> colors = new ArrayList<>();
for (String s : getPositions()) {
colors.add(Color.black);
}
if (nodes.size() >= 1) {
for (Integer id : nodes) {
if (id < 0) {
id = -id;
}
InputNode last = null;
int index = 0;
for (InputGraph g : group.getGraphs()) {
Color curColor = colors.get(index);
InputNode cur = g.getNode(id);
if (cur != null) {
if (last == null) {
curColor = Color.green;
} else {
if (last.equals(cur)) {
if (curColor == Color.black) {
curColor = Color.white;
}
} else {
if (curColor != Color.green) {
curColor = Color.orange;
}
}
}
}
last = cur;
colors.set(index, curColor);
index++;
}
}
}
setColors(colors);
viewChangedEvent.fire();
}
示例10: createGraphics
import java.awt.Color; //导入方法依赖的package包/类
/**
* Returns a Graphics2D object for rendering into the
* given BufferedImage.
* @throws NullPointerException if BufferedImage argument is null
*/
public Graphics2D createGraphics(BufferedImage img) {
if (img == null) {
throw new NullPointerException("BufferedImage cannot be null");
}
SurfaceData sd = SurfaceData.getPrimarySurfaceData(img);
return new SunGraphics2D(sd, Color.white, Color.black, defaultFont);
}
示例11: LoadColors
import java.awt.Color; //导入方法依赖的package包/类
public void LoadColors()
{
colors[GameResources.colorWhite] = Color.white;
colors[GameResources.colorBlack] = Color.black;
colors[GameResources.colorGreen] = new Color(game.gameOptions.colorGreenChat);
colors[GameResources.colorRed] = new Color(game.gameOptions.colorRedChat);
colors[GameResources.colorBlue] =new Color(game.gameOptions.colorBlueChat);
colors[GameResources.colorYellow] =new Color(game.gameOptions.colorYellowChat);
colors[GameResources.colorGray] = Color.gray;
colors[GameResources.colorMagenta] = Color.magenta;
colors[GameResources.colorDarkGray] = Color.darkGray;
colors[GameResources.colorOrange] = Color.orange;
colors[GameResources.colorCyan] = Color.cyan;
// Weapons
colors[GameResources.colorGreenWeapons] = new Color(game.gameOptions.colorGreenWeapons);
colors[GameResources.colorRedWeapons] = new Color(game.gameOptions.colorRedWeapons);
colors[GameResources.colorBlueWeapons] =new Color(game.gameOptions.colorBlueWeapons);
colors[GameResources.colorYellowWeapons] =new Color(game.gameOptions.colorYellowWeapons);
colors[GameResources.colorHealth] = new Color(255, 0, 0, 150);
colors[GameResources.colorEnergy] = new Color(0, 0, 255, 150);
colors[GameResources.colorBackground] = new Color(0, 0, 0, 130);
colors[GameResources.colorInterfaceShade] = new Color(0, 40, 0, 255);
colors[GameResources.colorPrivateMessage] = new Color(255, 153, 51);
colors[GameResources.colorName] = new Color(222, 170, 0);
colors[GameResources.colorPoints] = new Color(222, 120, 0);
}
示例12: buildInitialFactories
import java.awt.Color; //导入方法依赖的package包/类
protected void buildInitialFactories() {
int minWordLength = 6;
int maxWordLength = 6;
int fontSize = 50;
int imageWidth = 250;
int imageHeight = 100;
WordGenerator wordGenerator = new RandomWordGenerator("0123456789abcdefghijklmnopqrstuvwxyz");
RandomRangeColorGenerator cgen = new RandomRangeColorGenerator(new int[] { 0, 150 }, new int[] { 0, 150 },
new int[] { 0, 150 });
LineTextDecorator lineTextDecorator = new LineTextDecorator(1, cgen);// 曲线干扰
BaffleTextDecorator baffleTextDecorator = new BaffleTextDecorator(2, cgen);// 气泡干扰
TextDecorator[] textDecorators = new TextDecorator[2];
textDecorators[0] = lineTextDecorator;
textDecorators[1] = baffleTextDecorator;
TextPaster randomPaster = new DecoratedRandomTextPaster(minWordLength, maxWordLength,
new RandomListColorGenerator(
new Color[] { new Color(23, 170, 27), new Color(220, 34, 11), new Color(23, 67, 172) }),
textDecorators);
BackgroundGenerator background = new UniColorBackgroundGenerator(imageWidth, imageHeight, Color.white);
FontGenerator font = new RandomFontGenerator(fontSize, fontSize,
new Font[] { new Font("nyala", Font.BOLD, fontSize), new Font("Bell MT", Font.PLAIN, fontSize),
new Font("Credit valley", Font.BOLD, fontSize) });
ImageDeformation postDef = new ImageDeformationByFilters(new ImageFilter[] {});
ImageDeformation backDef = new ImageDeformationByFilters(new ImageFilter[] {});
ImageDeformation textDef = new ImageDeformationByFilters(new ImageFilter[] {});
WordToImage word2image = new DeformedComposedWordToImage(font, background, randomPaster, backDef, textDef,
postDef);
addFactory(new GimpyFactory(wordGenerator, word2image));
}
示例13: setEditable
import java.awt.Color; //导入方法依赖的package包/类
public void setEditable(boolean b) {
super.setEnabled(b);
if (b) {
super.setBackground(Color.white);
} else {
super.setBackground(Color.lightGray);
} // end of if (b)else
}
示例14: paintComponent
import java.awt.Color; //导入方法依赖的package包/类
protected @Override void paintComponent(Graphics g) {
updateRenderingHints(g);
Rectangle shape = new Rectangle(getSize());
Rectangle clip = g.getClipBounds();
FontColorSettings fcs = MimeLookup.getLookup(
org.netbeans.lib.editor.util.swing.DocumentUtilities.getMimeType(
editorUI.getComponent())).lookup(FontColorSettings.class);
AttributeSet attribs = fcs.getFontColors(FontColorNames.DEFAULT_COLORING);
Color backColor = (Color) attribs.getAttribute(StyleConstants.Background);
if (backColor == null) {
backColor = Color.white;
}
g.setColor(backColor);
g.fillRect(clip.x, clip.y, clip.width, clip.height);
g.translate(BORDER_WIDTH, BORDER_WIDTH);
JTextComponent component = editorUI.getComponent();
if (component == null) return;
int sideBarWidth = editorUI.getSideBarWidth();
/*
GlyphGutter gg = editorUI.getGlyphGutter();
if (gg!=null){
View docView = null;
if (view.getViewCount() == 1){//lockview
docView = view.getView(0);
}
int y = 0;
if (docView!=null){
AbstractDocument doc = (AbstractDocument)docView.getDocument();
doc.readLock();
try {
LockView lockView = LockView.get(docView);
if (lockView != null) {
lockView.lock();
try {
for (int i = 0; i<docView.getViewCount(); i++ ){
gg.paintGutterForView(g, docView.getView(i), y);
y += editorUI.getLineHeight();
}
} finally {
lockView.unlock();
}
}
} finally {
doc.readUnlock();
}
}else{
gg.paintGutterForView(g, view, 0);
}
g.translate(sideBarWidth,0);
}
view.paint(g, shape);
if (gg!=null){
g.translate(-sideBarWidth,0);
}
*/
g.translate(-BORDER_WIDTH, -BORDER_WIDTH);
g.setColor(backColor);
for (int i = 1; i<=BORDER_WIDTH; i++){
g.drawRect(clip.x+i,clip.y+i,clip.width-i*2-1,clip.height-i*2-1);
}
}
示例15: refreshUI
import java.awt.Color; //导入方法依赖的package包/类
private void refreshUI () {
int index = lCategories.getSelectedIndex ();
if (index < 0) {
cbForeground.setEnabled (false);
cbBackground.setEnabled (false);
return;
}
cbForeground.setEnabled (true);
cbBackground.setEnabled (true);
List<AttributeSet> categories = getCategories (currentProfile);
AttributeSet category = categories.get (index);
listen = false;
// set defaults
AttributeSet defAs = getDefaultColoring();
if (defAs != null) {
Color inheritedForeground = (Color) defAs.getAttribute(StyleConstants.Foreground);
if (inheritedForeground == null) {
inheritedForeground = Color.black;
}
ColorComboBoxSupport.setInheritedColor((ColorComboBox)cbForeground, inheritedForeground);
Color inheritedBackground = (Color) defAs.getAttribute(StyleConstants.Background);
if (inheritedBackground == null) {
inheritedBackground = Color.white;
}
ColorComboBoxSupport.setInheritedColor((ColorComboBox)cbBackground, inheritedBackground);
}
if (category.getAttribute(StyleConstants.Underline) != null) {
cbEffects.setSelectedIndex(1);
cbEffectColor.setEnabled(true);
((ColorComboBox) cbEffectColor).setSelectedColor((Color) category.getAttribute(StyleConstants.Underline));
} else if (category.getAttribute(EditorStyleConstants.WaveUnderlineColor) != null) {
cbEffects.setSelectedIndex(2);
cbEffectColor.setEnabled(true);
((ColorComboBox) cbEffectColor).setSelectedColor((Color) category.getAttribute(EditorStyleConstants.WaveUnderlineColor));
} else if (category.getAttribute(StyleConstants.StrikeThrough) != null) {
cbEffects.setSelectedIndex(3);
cbEffectColor.setEnabled(true);
((ColorComboBox) cbEffectColor).setSelectedColor((Color) category.getAttribute(StyleConstants.StrikeThrough));
} else {
cbEffects.setSelectedIndex(0);
cbEffectColor.setEnabled(false);
cbEffectColor.setSelectedIndex(-1);
}
// set values
ColorComboBoxSupport.setSelectedColor((ColorComboBox)cbForeground, (Color) category.getAttribute (StyleConstants.Foreground));
ColorComboBoxSupport.setSelectedColor((ColorComboBox)cbBackground, (Color) category.getAttribute (StyleConstants.Background));
listen = true;
}