Java Code Examples for java.awt.Color.BLACK

The following are Jave code examples for showing how to use BLACK of the java.awt.Color class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: ttyrec2video   File: VDURenderer.java   View Source Code Vote up 6 votes
/**
 * 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;
	}
}
 
Example 2
Project: parabuild-ci   File: MeterPlot.java   View Source Code Vote up 6 votes
/**
 * 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);
}
 
Example 3
Project: openjdk-jdk10   File: IndexingTest.java   View Source Code Vote up 6 votes
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;
}
 
Example 4
Project: OpenJSharp   File: LineBorder.java   View Source Code Vote up 5 votes
/** 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;
}
 
Example 5
Project: MaxSim   File: DiagramViewModel.java   View Source Code Vote up 5 votes
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();
}
 
Example 6
Project: OpenJSharp   File: StyleConstants.java   View Source Code Vote up 5 votes
/**
 * 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;
}
 
Example 7
Project: incubator-netbeans   File: OptionsPanel.java   View Source Code Vote up 5 votes
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;
}
 
Example 8
Project: QN-ACTR-Release   File: ConnectState.java   View Source Code Vote up 5 votes
@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();
		}
	}

}
 
Example 9
Project: parabuild-ci   File: ExtendedCategoryAxis.java   View Source Code Vote up 5 votes
/**
 * 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;
}
 
Example 10
Project: AppleCommander   File: DiskExplorer.java   View Source Code Vote up 5 votes
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)];
}
 
Example 11
Project: openjdk-jdk10   File: LineBorder.java   View Source Code Vote up 5 votes
/**
 * 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;
}
 
Example 12
Project: OpenJSharp   File: SunVolatileImage.java   View Source Code Vote up 5 votes
private Color getForeground() {
    if (comp != null) {
        return comp.getForeground();
    } else {
        return Color.black;
    }
}
 
Example 13
Project: incubator-netbeans   File: AnnotationsPanel.java   View Source Code Vote up 4 votes
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;
}
 
Example 14
Project: incubator-netbeans   File: HighlightingPanel.java   View Source Code Vote up 4 votes
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;
   }
 
Example 15
Project: ramus   File: Component.java   View Source Code Vote up 4 votes
public Color getDefaultFontColor() {
    return Color.black;
}
 
Example 16
Project: VASSAL-src   File: Region.java   View Source Code Vote up 4 votes
public void draw(Graphics g, Rectangle bounds, Rectangle visibleRect, double scale, boolean reversed, int xOffset, int yOffset) {
  if (!bounds.intersects(visibleRect)) {
    return;
  }

  final int labelOffset = 7;

  int size = (int) (scale * myGrid.getFontSize() + 0.5);
  Font f = new Font("Dialog", Font.PLAIN, size); //$NON-NLS-1$

  Color fg = selected ? Color.white : Color.black;
  Color bg = selected ? Color.black : Color.white;

  Rectangle region = bounds.intersection(visibleRect);

  Shape oldClip = g.getClip();
  if (oldClip != null) {
    Area clipArea = new Area(oldClip);
    clipArea.intersect(new Area(region));
    g.setClip(clipArea);
  }

  int posX = (int) (scale * origin.x + 0.5) + bounds.x - 1 + xOffset;
  int posY = (int) (scale * origin.y + 0.5) + bounds.y - 1 + yOffset;

  Color saveColor = g.getColor();

  g.setColor(bg);
  g.fillRect(posX, posY, 3, 3);
  g.setColor(fg);
  g.drawRect(posX, posY, 3, 3);

  g.setColor(saveColor);

  Labeler.drawLabel(g, getLocalizedConfigureName(), posX, posY + labelOffset, f, Labeler.CENTER,
                    Labeler.TOP, fg, bg, fg);
  g.setClip(oldClip);

  // Calculate and store the selection rectangle
  int width = g.getFontMetrics().stringWidth(getConfigureName() + "  ")+1; //$NON-NLS-1$
  int height = g.getFontMetrics().getHeight()+1;

  selectionRect.setLocation(posX - (width / 2), posY - 1);
  selectionRect.setSize(width, height + labelOffset + 1);

}
 
Example 17
Project: agar.io   File: Options.java   View Source Code Vote up 4 votes
public void drawOptions() {
	
	//Options Screen
	optionsScreenOutline = EZ.addRectangle(HALF_SCREEN_WIDTH, HALF_SCREEN_HEIGHT, SCREEN_WIDTH - 800 + BORDER, SCREEN_HEIGHT - 150 + BORDER, new Color(0, 0, 0, 120), true);
	optionsScreen = EZ.addRectangle(HALF_SCREEN_WIDTH, HALF_SCREEN_HEIGHT, SCREEN_WIDTH - 800, SCREEN_HEIGHT - 150, new Color(Color.green.getRed(), Color.green.getGreen(), Color.green.getBlue(), 200), true);
	optionsScreenTitle = EZ.addText(optionsScreen.getXCenter(), optionsScreen.getYCenter() - 400, "Options", Color.black, 50);
	
	//Options EZTexts
	int verticalGap = 150; //Vertical gap in between each option
	int fs = 30; //Font size
	Color c = Color.black;
	maxDots = EZ.addText(optionsScreenTitle.getXCenter() - 300, optionsScreenTitle.getYCenter() + 100, "Maximum Dots", c, fs);
	maxBlobs = EZ.addText(maxDots.getXCenter(), maxDots.getYCenter() + verticalGap, "Maximum Blobs", c, fs);
	maxPlayerMass = EZ.addText(maxBlobs.getXCenter(), maxBlobs.getYCenter() + verticalGap, "Maximum Player Mass", c, fs);
	maxBlobMass = EZ.addText(maxPlayerMass.getXCenter(), maxPlayerMass.getYCenter() + verticalGap, "Maximum Blob Mass", c, fs);
	dotMass = EZ.addText(maxBlobMass.getXCenter(), maxBlobMass.getYCenter() + verticalGap, "Dot Mass", c, fs);
	

	//Options decrease/increase buttons
	int leftJustified = optionsScreenTitle.getXCenter() + 50; //Line up all the down buttons 
	int horizontalGap = 350; //Horizontal gap in between the down and up buttons
	down1 = EZ.addImage("resources/buttons/down1.png", leftJustified, optionsScreenTitle.getYCenter() + 100);
	up1 = EZ.addImage("resources/buttons/up1.png", leftJustified + horizontalGap, optionsScreenTitle.getYCenter() + 100);
	down2 = EZ.addImage("resources/buttons/down2.png", leftJustified, down1.getYCenter() + verticalGap);
	up2 = EZ.addImage("resources/buttons/up2.png", leftJustified + horizontalGap, up1.getYCenter() + verticalGap);
	down3 = EZ.addImage("resources/buttons/down2.png", leftJustified, down2.getYCenter() + verticalGap);
	up3 = EZ.addImage("resources/buttons/up2.png", leftJustified + horizontalGap, up2.getYCenter() + verticalGap);
	down4 = EZ.addImage("resources/buttons/down3.png", leftJustified, down3.getYCenter() + verticalGap);
	up4 = EZ.addImage("resources/buttons/up4.png", leftJustified + horizontalGap, up3.getYCenter() + verticalGap);
	down5 = EZ.addImage("resources/buttons/down5.png", leftJustified, down4.getYCenter() + verticalGap);
	up5 = EZ.addImage("resources/buttons/up5.png", leftJustified + horizontalGap, up4.getYCenter() + verticalGap);

	//Options EZText values 
	int between = (down1.getXCenter() + up1.getXCenter()) / 2;
	maxDotsVal = EZ.addText(between, down1.getYCenter(), Integer.toString(Dot.maxDots), c, fs);
	maxBlobsVal = EZ.addText(between, down2.getYCenter(), Integer.toString(Blob.maxBlobs), c, fs);
	maxPlayerMassVal = EZ.addText(between, down3.getYCenter(), Integer.toString(Player.maxMass), c, fs);
	maxBlobMassVal = EZ.addText(between, down4.getYCenter(), Integer.toString(Blob.maxMass), c, fs);
	dotMassVal = EZ.addText(between, down5.getYCenter(), Integer.toString(Dot.mass), c, fs);
	
	//Back Button
	backOutline = EZ.addRectangle(100, 100, 150 + BORDER, 100 + BORDER, Color.black, true);
	backButton = EZ.addRectangle(100, 100, 150, 100, Color.green, true);
	backText = EZ.addText(backButton.getXCenter(), backButton.getYCenter(), "Back", Color.black, 30);

	//Default Button
	defaultButton = EZ.addText(HALF_SCREEN_WIDTH + 400, HALF_SCREEN_HEIGHT - 400, "Default", Color.white, 30);

	interactOptions();
}
 
Example 18
Project: openjdk-jdk10   File: PSPrinterJob.java   View Source Code Vote up 4 votes
GState() {
    mColor = Color.black;
    mClip = null;
    mFont = null;
    mTransform = new AffineTransform();
}
 
Example 19
Project: parabuild-ci   File: AbstractRenderer.java   View Source Code Vote up 4 votes
/**
 * Default constructor.
 */
public AbstractRenderer() {

    this.seriesVisible = null;
    this.seriesVisibleList = new BooleanList();
    this.baseSeriesVisible = true;
    
    this.paint = null;
    this.paintList = new PaintList();
    this.basePaint = DEFAULT_PAINT;

    this.outlinePaint = null;
    this.outlinePaintList = new PaintList();
    this.baseOutlinePaint = DEFAULT_OUTLINE_PAINT;

    this.stroke = null;
    this.strokeList = new StrokeList();
    this.baseStroke = DEFAULT_STROKE;

    this.outlineStroke = null;
    this.outlineStrokeList = new StrokeList();
    this.baseOutlineStroke = DEFAULT_OUTLINE_STROKE;

    this.shape = null;
    this.shapeList = new ShapeList();
    this.baseShape = DEFAULT_SHAPE;

    this.itemLabelsVisible = null;
    this.itemLabelsVisibleList = new BooleanList();
    this.baseItemLabelsVisible = Boolean.FALSE;

    this.itemLabelFont = null;
    this.itemLabelFontList = new ObjectList();
    this.baseItemLabelFont = new Font("SansSerif", Font.PLAIN, 10);

    this.itemLabelPaint = null;
    this.itemLabelPaintList = new PaintList();
    this.baseItemLabelPaint = Color.black;

    this.positiveItemLabelPosition = null;
    this.positiveItemLabelPositionList = new ObjectList();
    this.basePositiveItemLabelPosition = new ItemLabelPosition(
        ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER
    );
    
    this.negativeItemLabelPosition = null;
    this.negativeItemLabelPositionList = new ObjectList();
    this.baseNegativeItemLabelPosition = new ItemLabelPosition(
        ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_CENTER
    );

    this.listenerList = new EventListenerList();

}
 
Example 20
Project: parabuild-ci   File: XYLineAnnotation.java   View Source Code Vote up 2 votes
/**
 * Creates a new annotation that draws a line from (x1, y1) to (x2, y2) where 
 * the coordinates are measured in data space (that is, against the plot's axes).
 * 
 * @param x1  the x-coordinate for the start of the line.
 * @param y1  the y-coordinate for the start of the line.
 * @param x2  the x-coordinate for the end of the line.
 * @param y2  the y-coordinate for the end of the line.
 */
public XYLineAnnotation(double x1, double y1, double x2, double y2) {
    this(x1, y1, x2, y2, new BasicStroke(1.0f), Color.black);
}