本文整理汇总了Java中java.awt.Color.black方法的典型用法代码示例。如果您正苦于以下问题:Java Color.black方法的具体用法?Java Color.black怎么用?Java Color.black使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Color
的用法示例。
在下文中一共展示了Color.black方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
}
示例2: MeterPlot
import java.awt.Color; //导入方法依赖的package包/类
/**
* Creates a new plot that displays the value from the supplied dataset.
*
* @param dataset the dataset (<code>null</code> permitted).
*/
public MeterPlot(ValueDataset dataset) {
super();
this.shape = DialShape.CIRCLE;
this.meterAngle = DEFAULT_METER_ANGLE;
this.range = new Range(0.0, 100.0);
this.tickSize = 10.0;
this.tickPaint = Color.white;
this.units = "Units";
this.needlePaint = MeterPlot.DEFAULT_NEEDLE_PAINT;
this.tickLabelsVisible = true;
this.tickLabelFont = MeterPlot.DEFAULT_LABEL_FONT;
this.tickLabelPaint = Color.black;
this.tickLabelFormat = NumberFormat.getInstance();
this.valueFont = MeterPlot.DEFAULT_VALUE_FONT;
this.valuePaint = MeterPlot.DEFAULT_VALUE_PAINT;
this.dialBackgroundPaint = MeterPlot.DEFAULT_DIAL_BACKGROUND_PAINT;
this.intervals = new java.util.ArrayList();
setDataset(dataset);
}
示例3: 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;
}
示例4: createBlackLineBorder
import java.awt.Color; //导入方法依赖的package包/类
/** Convenience method for getting the Color.black LineBorder of thickness 1.
*/
public static Border createBlackLineBorder() {
if (blackLine == null) {
blackLine = new LineBorder(Color.black, 1);
}
return blackLine;
}
示例5: 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();
}
示例6: getBackground
import java.awt.Color; //导入方法依赖的package包/类
/**
* Gets the background color setting from the attribute list.
*
* @param a the attribute set
* @return the color, Color.black as the default
*/
public static Color getBackground(AttributeSet a) {
Color fg = (Color) a.getAttribute(Background);
if (fg == null) {
fg = Color.black;
}
return fg;
}
示例7: getTabPanelForeground
import java.awt.Color; //导入方法依赖的package包/类
private static Color getTabPanelForeground() {
if( isMetal || isNimbus ) {
Color res = UIManager.getColor( "Tree.foreground" ); //NOI18N
if( null == res )
res = Color.black;
return new Color( res.getRGB() );
}
return Color.black;
}
示例8: handleDrag
import java.awt.Color; //导入方法依赖的package包/类
@Override
public void handleDrag(MouseEvent e) {
if (firstPort != null) {
if (!e.isConsumed()) {
Graphics2D g = mediator.getGraphGraphics();
Color bg = mediator.getGraphBackground();
Color fg = Color.black;
g.setColor(fg);
g.setXORMode(bg);
overlay(g);
current = mediator.snap(e.getPoint());
port = getInPortViewAt(e.getX(), e.getY());
if (port != null) {
current = mediator.toScreen(port.getLocation(null));
}
g.setColor(bg);
g.setXORMode(fg);
overlay(g);
e.consume();
}
}
}
示例9: ExtendedCategoryAxis
import java.awt.Color; //导入方法依赖的package包/类
/**
* Creates a new axis.
*
* @param label the axis label.
*/
public ExtendedCategoryAxis(String label) {
super(label);
this.sublabels = new HashMap();
this.sublabelFont = new Font("SansSerif", Font.PLAIN, 10);
this.sublabelPaint = Color.black;
}
示例10: 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)];
}
示例11: createBlackLineBorder
import java.awt.Color; //导入方法依赖的package包/类
/**
* Convenience method for getting the Color.black LineBorder of thickness 1.
*
* @return a {@code LineBorder} with {@code Color.black} and thickness of 1
*/
public static Border createBlackLineBorder() {
if (blackLine == null) {
blackLine = new LineBorder(Color.black, 1);
}
return blackLine;
}
示例12: getForeground
import java.awt.Color; //导入方法依赖的package包/类
private Color getForeground() {
if (comp != null) {
return comp.getForeground();
} else {
return Color.black;
}
}
示例13: refreshUI
import java.awt.Color; //导入方法依赖的package包/类
private void refreshUI () {
int index = lCategories.getSelectedIndex ();
if (index < 0) {
// no category selected
cbForeground.setEnabled (false);
cbBackground.setEnabled (false);
cbEffectColor.setEnabled (false);
return;
}
cbForeground.setEnabled (true);
cbBackground.setEnabled (true);
cbEffectColor.setEnabled (true);
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);
}
// set values
List<AttributeSet> annotations = getAnnotations (currentScheme);
AttributeSet c = annotations.get (index);
ColorComboBoxSupport.setSelectedColor( (ColorComboBox)cbForeground, (Color) c.getAttribute (StyleConstants.Foreground));
ColorComboBoxSupport.setSelectedColor( (ColorComboBox)cbBackground, (Color) c.getAttribute (StyleConstants.Background));
if (c.getAttribute(EditorStyleConstants.WaveUnderlineColor) != null) {
cbEffects.setSelectedIndex(1);
cbEffectColor.setEnabled(true);
((ColorComboBox)cbEffectColor).setSelectedColor((Color) c.getAttribute (EditorStyleConstants.WaveUnderlineColor));
} else {
cbEffects.setSelectedIndex(0);
cbEffectColor.setEnabled(false);
cbEffectColor.setSelectedIndex(-1);
}
listen = true;
}
示例14: 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;
}
示例15: getDefaultFontColor
import java.awt.Color; //导入方法依赖的package包/类
public Color getDefaultFontColor() {
return Color.black;
}