Java Code Examples for java.awt.Color#WHITE

The following examples show how to use java.awt.Color#WHITE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GradientHandles.java    From Pixelitor with GNU General Public License v3.0 6 votes vote down vote up
public GradientHandles(double startX, double startY,
                       double endX, double endY, View view) {
    this.view = view;
    Color defaultColor = Color.WHITE;
    Color activeColor = Color.RED;

    start = new GradientDefiningPoint("start", startX, startY, view,
            defaultColor, activeColor, this);
    end = new GradientDefiningPoint("end", endX, endY, view,
            defaultColor, activeColor, this);
    middle = new GradientCenterPoint(start, end, view, defaultColor, activeColor);

    end.setOther(start);
    end.setCenter(middle);
    start.setOther(end);
    start.setCenter(middle);
}
 
Example 2
Source File: ImageGenerator.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public ImageGenerator(int _width, int _height, Color bgColor)
{
      width = _width;
      height = _height;
      bi = new BufferedImage(
          width,
          height,
          BufferedImage.TYPE_INT_ARGB);
      Graphics gr = bi.getGraphics();
      if(null==bgColor){
          bgColor = Color.WHITE;
      }
      gr.setColor(bgColor);
      gr.fillRect(0, 0, width, height);
      paint(gr);
      gr.dispose();
}
 
Example 3
Source File: ImageGenerator.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public ImageGenerator(int _width, int _height, Color bgColor)
{
      width = _width;
      height = _height;
      bi = new BufferedImage(
          width,
          height,
          BufferedImage.TYPE_INT_ARGB);
      Graphics gr = bi.getGraphics();
      if(null==bgColor){
          bgColor = Color.WHITE;
      }
      gr.setColor(bgColor);
      gr.fillRect(0, 0, width, height);
      paint(gr);
      gr.dispose();
}
 
Example 4
Source File: ConsoleColors.java    From MeteoInfo with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Constructor
 * @param lookFeel Look and feel
 */
public ConsoleColors(String lookFeel) {
    switch (lookFeel) {
        case "Darcula":
        case "FlatDarculaLaf":
        case "FlatDarkLaf":
            this.promptColor = new Color(255, 100, 100);
            this.commandColor = Color.WHITE;
            this.codeLinesColor = new Color(0, 153, 204);
            break;
        default:
            this.promptColor = Color.RED;
            this.commandColor = Color.BLACK;
            this.codeLinesColor = Color.BLUE;
            break;
    }
}
 
Example 5
Source File: ImageWriter.java    From SciGraph with Apache License 2.0 6 votes vote down vote up
@Override
public Paint transform(Vertex vertex) {
  if (vertex.getPropertyKeys().contains(Concept.CATEGORY)) {
    Object categories = vertex.getProperty(Concept.CATEGORY);
    if (categories.getClass().isArray() || categories instanceof Iterable) {
      return Color.WHITE;
    } else {
      String category = (String) categories;
      if (!colorMap.containsKey(category)) {
        if (index > colors.size()) {
          return Color.WHITE;
        } else {
          colorMap.put(category, colors.get(index++));
        }
      }
      return colorMap.get(category);
    }
  } else {
    return Color.WHITE;
  }
}
 
Example 6
Source File: TimelineSelectionOverlay.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void initDefaultValues() {
    sMarkPaint = new Color(120, 120, 120);
    sOddPerfPaint = new Color(120, 120, 120);
    sEvenPerfPaint = Color.WHITE;

    hMarkPaint = new Color(80, 80, 80);
    hOddPerfPaint = Color.BLACK;
    hEvenPerfPaint = Color.WHITE;

    markStroke = new BasicStroke(2.8f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
    oddPerfStroke = new BasicStroke(1f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL, 0, new float[] { 1.0f, 3.0f }, 0);
    evenPerfStroke = new BasicStroke(1f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL, 0, new float[] { 1.0f, 3.0f }, 2);

    selectionExtent = 3;
}
 
Example 7
Source File: DriftNetConfig.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@ConfigItem(
	position = 2,
	keyName = "countColor",
	name = "Fish count color",
	description = "Color of the fish count text"
)
default Color countColor()
{
	return Color.WHITE;
}
 
Example 8
Source File: LabelImagesTest.java    From MorphoLibJ with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Test
public final void testLabelToRGB_ImageProcessorByteArrayColor()
{
	// create a byte processor containing four labels
	ImageProcessor image = new ByteProcessor(10, 10);
	for (int y = 0; y < 3; y++)
	{
		for (int x = 0; x < 3; x++)
		{
			image.set(x + 1, y + 1, 1);
			image.set(x + 5, y + 1, 2);
			image.set(x + 1, y + 5, 3);
			image.set(x + 5, y + 5, 4);
		}
	}
	
	// create LUT and background color
	byte[][] lut = CommonLabelMaps.GOLDEN_ANGLE.computeLut(4, false);
	Color bgColor = Color.WHITE;
	
	// compute color image from labels
	ColorProcessor colorImage = LabelImages.labelToRgb(image, lut, bgColor);

	Assert.assertNotEquals(0, colorImage.get(2, 2));
	Assert.assertNotEquals(0, colorImage.get(6, 2));
	Assert.assertNotEquals(0, colorImage.get(2, 6));
	Assert.assertNotEquals(0, colorImage.get(6, 6));
}
 
Example 9
Source File: ProfilerXYSelectionOverlay.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void initDefaultValues() {
    markPaint = new Color(80, 80, 80);
    oddPerfPaint = Color.BLACK;
    evenPerfPaint = Color.WHITE;

    markStroke = new BasicStroke(2.8f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
    oddPerfStroke = new BasicStroke(1f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL, 0, new float[] { 1.0f, 3.0f }, 0);
    evenPerfStroke = new BasicStroke(1f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL, 0, new float[] { 1.0f, 3.0f }, 2);

    selectionExtent = 3;
}
 
Example 10
Source File: VectorColorMapper.java    From osp with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Converts a double to a the complementary color.
 * @param mag
 * @return the color
 */
public Color doubleToCompColor(double mag) {
  if(mag<=floor) { // magnitudes less than floor are clear
    return background;
  }
  int index;
  switch(paletteType) {
     case RED :
       if(mag>=ceil) {
         return RED_COMP;
       }
       index = (int) ((numColors-1)*(mag/ceil));
       return compColors[index];                                               // shade of red
     case BLUE :
       if(mag>=ceil) {
         return BLUE_COMP;
       }
       index = (int) ((numColors-1)*(mag/ceil));
       return compColors[index];                                               // shade of blue
     case GREEN :
       if(mag>=ceil) {
         return GREEN_COMP;
       }
       index = (int) ((numColors-1)*(mag/ceil));
       return compColors[index];                                               // shade of green
     case BLACK :                                                              // complement of BLACK is WHITE
       return Color.WHITE;
     case GRAY :                                                               // cannot complement gray
       if(mag>=ceil) {
         return Color.black;
       }
       index = (int) ((numColors-1)*(mag/ceil));
       return colors[index];                                                   // shade of gray from white
     default :                                                                 // spectrum of colors from light blue toward blue toward red toward black
       Color c = getSpectrumColor(mag);
       float[] hsb = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
       float[] hsbBack = Color.RGBtoHSB(background.getRed(), background.getGreen(), background.getBlue(), null);
       return Color.getHSBColor((2*hsbBack[0]-hsb[0]+0.5f)%1, hsb[1], hsb[2]); // complementary hue
  }
}
 
Example 11
Source File: ImplingsConfig.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@ConfigItem(
	position = 3,
	keyName = "spawnColor",
	name = "Impling spawn color",
	description = "Text color for impling spawns in Puro Puro",
	titleSection = "puropuroTitle"
)
default Color getSpawnColor()
{
	return Color.WHITE;
}
 
Example 12
Source File: ImplingsConfig.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@ConfigItem(
	position = 4,
	keyName = "spawnColorDynamic",
	name = "Impling dynamic spawn color",
	description = "Text color for dynamic impling spawns in Puro Puro",
	titleSection = "puropuroTitle"
)
default Color getDynamicSpawnColor()
{
	return Color.WHITE;
}
 
Example 13
Source File: WindowsLookAndFeel.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Object configureValue(Object value) {
    Object highContrastOn = Toolkit.getDefaultToolkit().
            getDesktopProperty("win.highContrast.on");
    if (highContrastOn == null || !((Boolean) highContrastOn).booleanValue()) {
        return Color.BLACK;
    }
    return Color.BLACK.equals(value) ? Color.WHITE : Color.BLACK;
}
 
Example 14
Source File: ExportServlet.java    From blog-codes with Apache License 2.0 4 votes vote down vote up
/**
 * Gets the parameters and logs the request.
 * 
 * @throws ParserConfigurationException 
 * @throws SAXException 
 * @throws DocumentException 
 */
protected void handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception
{
	// Parses parameters
	String format = request.getParameter("format");
	String fname = request.getParameter("filename");
	int w = Integer.parseInt(request.getParameter("w"));
	int h = Integer.parseInt(request.getParameter("h"));
	String tmp = request.getParameter("bg");
	String xml = getRequestXml(request);

	Color bg = (tmp != null) ? mxUtils.parseColor(tmp) : null;

	// Checks parameters
	if (w > 0 && h > 0 && w * h < Constants.MAX_AREA && format != null && xml != null && xml.length() > 0)
	{
		// Allows transparent backgrounds only for PNG
		if (bg == null && !format.equals("png"))
		{
			bg = Color.WHITE;
		}

		if (fname != null && fname.toLowerCase().endsWith(".xml"))
		{
			fname = fname.substring(0, fname.length() - 4) + format;
		}

		String url = request.getRequestURL().toString();

		// Writes response
		if (format.equals("pdf"))
		{
			writePdf(url, fname, w, h, bg, xml, response);
		}
		else
		{
			writeImage(url, format, fname, w, h, bg, xml, response);
		}

		response.setStatus(HttpServletResponse.SC_OK);
	}
	else
	{
		response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
	}
}
 
Example 15
Source File: Decoration.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
public void drawTextAndDecorations(Label label,
                            Graphics2D g2d,
                            float x,
                            float y) {

    if (fgPaint == null && bgPaint == null && swapColors == false) {
        drawTextAndEmbellishments(label, g2d, x, y);
    }
    else {
        Paint savedPaint = g2d.getPaint();
        Paint foreground, background;

        if (swapColors) {
            background = fgPaint==null? savedPaint : fgPaint;
            if (bgPaint == null) {
                if (background instanceof Color) {
                    Color bg = (Color)background;
                    // 30/59/11 is standard weights, tweaked a bit
                    int brightness = 33 * bg.getRed()
                        + 53 * bg.getGreen()
                        + 14 * bg.getBlue();
                    foreground = brightness > 18500 ? Color.BLACK : Color.WHITE;
                } else {
                    foreground = Color.WHITE;
                }
            } else {
                foreground = bgPaint;
            }
        }
        else {
            foreground = fgPaint==null? savedPaint : fgPaint;
            background = bgPaint;
        }

        if (background != null) {

            Rectangle2D bgArea = label.getLogicalBounds();
            bgArea = new Rectangle2D.Float(x + (float)bgArea.getX(),
                                        y + (float)bgArea.getY(),
                                        (float)bgArea.getWidth(),
                                        (float)bgArea.getHeight());

            g2d.setPaint(background);
            g2d.fill(bgArea);
        }

        g2d.setPaint(foreground);
        drawTextAndEmbellishments(label, g2d, x, y);
        g2d.setPaint(savedPaint);
    }
}
 
Example 16
Source File: javax_swing_border_SoftBevelBorder.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
protected SoftBevelBorder getObject() {
    return new SoftBevelBorder(BevelBorder.RAISED, Color.RED, Color.GREEN, Color.BLUE, Color.WHITE);
}
 
Example 17
Source File: javax_swing_border_BevelBorder.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
protected BevelBorder getObject() {
    return new BevelBorder(BevelBorder.RAISED, Color.RED, Color.GREEN, Color.BLUE, Color.WHITE);
}
 
Example 18
Source File: javax_swing_border_BevelBorder.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
protected BevelBorder getObject() {
    return new BevelBorder(BevelBorder.RAISED, Color.RED, Color.GREEN, Color.BLUE, Color.WHITE);
}
 
Example 19
Source File: java_awt_GradientPaint.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
protected GradientPaint getObject() {
    return new GradientPaint(0.1f, 0.2f, Color.BLACK, 0.3f, 0.4f, Color.WHITE, true);
}
 
Example 20
Source File: PathColorsCanvas.java    From SNT with GNU General Public License v3.0 4 votes vote down vote up
private Color contrastColor(final Color c) {
	final int intensity = (c.getRed() + c.getGreen() + c.getBlue()) / 3;
	return intensity < 128 ? Color.WHITE : Color.BLACK;
}