Java Code Examples for java.awt.Color#pink()

The following examples show how to use java.awt.Color#pink() . These examples are extracted from open source projects. 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
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
{
	Component renderer = DEFAULT_RENDERER.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
	Color foreground, background;
	if (isSelected)
	{
		foreground = Color.black;
		background = Color.orange;
	}
	else
	{
		foreground = Color.black;
		background = Color.pink;
	}
	renderer.setForeground(foreground);
	renderer.setBackground(background);
	return renderer;
}
 
Example 2
/**
 * Convenience method to return an array of <code>Paint</code> objects that
 * represent the pre-defined colors in the <code>Color</code> and
 * <code>ChartColor</code> objects.
 *
 * @return An array of objects with the <code>Paint</code> interface.
 */
public static Paint[] createDefaultPaintArray() {

    return new Paint[] {
        new Color(0xFF, 0x55, 0x55),
        new Color(0x55, 0x55, 0xFF),
        new Color(0x55, 0xFF, 0x55),
        new Color(0xFF, 0xFF, 0x55),
        new Color(0xFF, 0x55, 0xFF),
        new Color(0x55, 0xFF, 0xFF),
        Color.pink,
        Color.gray,
        ChartColor.DARK_RED,
        ChartColor.DARK_BLUE,
        ChartColor.DARK_GREEN,
        ChartColor.DARK_YELLOW,
        ChartColor.DARK_MAGENTA,
        ChartColor.DARK_CYAN,
        Color.darkGray,
        ChartColor.LIGHT_RED,
        ChartColor.LIGHT_BLUE,
        ChartColor.LIGHT_GREEN,
        ChartColor.LIGHT_YELLOW,
        ChartColor.LIGHT_MAGENTA,
        ChartColor.LIGHT_CYAN,
        Color.lightGray,
        ChartColor.VERY_DARK_RED,
        ChartColor.VERY_DARK_BLUE,
        ChartColor.VERY_DARK_GREEN,
        ChartColor.VERY_DARK_YELLOW,
        ChartColor.VERY_DARK_MAGENTA,
        ChartColor.VERY_DARK_CYAN,
        ChartColor.VERY_LIGHT_RED,
        ChartColor.VERY_LIGHT_BLUE,
        ChartColor.VERY_LIGHT_GREEN,
        ChartColor.VERY_LIGHT_YELLOW,
        ChartColor.VERY_LIGHT_MAGENTA,
        ChartColor.VERY_LIGHT_CYAN
    };
}
 
Example 3
/**
     * Get common color
     *
     * @param idx Index
     * @return Common color
     */
    public static Color getCommonColor(int idx) {
//        if (idx == 0) {
//            idx = 1;
//        }
        if (idx > 11) {
            idx = idx % 11;
        }

        switch (idx) {
            case 0:
                return Color.red;
            case 1:
                return Color.blue;
            case 2:
                return Color.green;
            case 3:
                return Color.black;
            case 4:
                return Color.yellow;
            case 5:
                return Color.pink;
            case 6:
                return Color.gray;
            case 7:
                return Color.cyan;
            case 8:
                return Color.magenta;
            case 9:
                return Color.orange;
            case 10:
                return Color.darkGray;
            case 11:
                return Color.lightGray;
        }

        return Color.red;
    }
 
Example 4
/**
 * Convenience method to return an array of <code>Paint</code> objects that
 * represent the pre-defined colors in the <code>Color</code> and
 * <code>ChartColor</code> objects.
 *
 * @return An array of objects with the <code>Paint</code> interface.
 */
public static Paint[] createDefaultPaintArray() {

    return new Paint[] {
        new Color(0xFF, 0x55, 0x55),
        new Color(0x55, 0x55, 0xFF),
        new Color(0x55, 0xFF, 0x55),
        new Color(0xFF, 0xFF, 0x55),
        new Color(0xFF, 0x55, 0xFF),
        new Color(0x55, 0xFF, 0xFF),
        Color.pink,
        Color.gray,
        ChartColor.DARK_RED,
        ChartColor.DARK_BLUE,
        ChartColor.DARK_GREEN,
        ChartColor.DARK_YELLOW,
        ChartColor.DARK_MAGENTA,
        ChartColor.DARK_CYAN,
        Color.darkGray,
        ChartColor.LIGHT_RED,
        ChartColor.LIGHT_BLUE,
        ChartColor.LIGHT_GREEN,
        ChartColor.LIGHT_YELLOW,
        ChartColor.LIGHT_MAGENTA,
        ChartColor.LIGHT_CYAN,
        Color.lightGray,
        ChartColor.VERY_DARK_RED,
        ChartColor.VERY_DARK_BLUE,
        ChartColor.VERY_DARK_GREEN,
        ChartColor.VERY_DARK_YELLOW,
        ChartColor.VERY_DARK_MAGENTA,
        ChartColor.VERY_DARK_CYAN,
        ChartColor.VERY_LIGHT_RED,
        ChartColor.VERY_LIGHT_BLUE,
        ChartColor.VERY_LIGHT_GREEN,
        ChartColor.VERY_LIGHT_YELLOW,
        ChartColor.VERY_LIGHT_MAGENTA,
        ChartColor.VERY_LIGHT_CYAN
    };
}
 
Example 5
public static Color parseColor(String color) {
	if(color != null) {
		if(color.trim().startsWith("#")){
			// HTML colors (#FFFFFF format)
			return new Color(Integer.parseInt(color.substring(1), 16));
		}else if(color.trim().startsWith("rgb")){
			// HTML colors (rgb(255, 255, 255) format)
			String values = color.substring(color.indexOf("(") + 1, color.indexOf(")"));
			String rgb[] = values.split(",");
			return new Color(Integer.parseInt(rgb[0].trim()), Integer.parseInt(rgb[1].trim()), Integer.parseInt(rgb[2].trim()));
		}else{
			// Colors by name
			if(color.equalsIgnoreCase("black")) return Color.black;
			if(color.equalsIgnoreCase("grey")) return Color.gray;
			if(color.equalsIgnoreCase("yellow")) return Color.yellow;
			if(color.equalsIgnoreCase("green")) return Color.green;
			if(color.equalsIgnoreCase("blue")) return Color.blue;
			if(color.equalsIgnoreCase("red")) return Color.red;
			if(color.equalsIgnoreCase("orange")) return Color.orange;
			if(color.equalsIgnoreCase("cyan")) return Color.cyan;
			if(color.equalsIgnoreCase("magenta")) return Color.magenta;
			if(color.equalsIgnoreCase("darkgray")) return Color.darkGray;
			if(color.equalsIgnoreCase("lightgray")) return Color.lightGray;
			if(color.equalsIgnoreCase("pink")) return Color.pink;
			if(color.equalsIgnoreCase("white")) return Color.white;
		}
	}
	log.info("Unable to parse body background-color (color:" + color+"). Assuming white.");
	return Color.white;
}
 
Example 6
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 7
private static Color parseColor(String color) {
	if(color != null) {
		if(color.trim().startsWith("#")){
			// HTML colors (#FFFFFF format)
			return new Color(Integer.parseInt(color.substring(1), 16));
		}else if(color.trim().startsWith("rgb")){
			// HTML colors (rgb(255, 255, 255) format)
			String values = color.substring(color.indexOf("(") + 1, color.indexOf(")"));
			String rgb[] = values.split(",");
			return new Color(Integer.parseInt(rgb[0].trim()), Integer.parseInt(rgb[1].trim()), Integer.parseInt(rgb[2].trim()));
		}else{
			// Colors by name
			if(color.equalsIgnoreCase("black")) return Color.black;
			if(color.equalsIgnoreCase("grey")) return Color.gray;
			if(color.equalsIgnoreCase("yellow")) return Color.yellow;
			if(color.equalsIgnoreCase("green")) return Color.green;
			if(color.equalsIgnoreCase("blue")) return Color.blue;
			if(color.equalsIgnoreCase("red")) return Color.red;
			if(color.equalsIgnoreCase("orange")) return Color.orange;
			if(color.equalsIgnoreCase("cyan")) return Color.cyan;
			if(color.equalsIgnoreCase("magenta")) return Color.magenta;
			if(color.equalsIgnoreCase("darkgray")) return Color.darkGray;
			if(color.equalsIgnoreCase("lightgray")) return Color.lightGray;
			if(color.equalsIgnoreCase("pink")) return Color.pink;
			if(color.equalsIgnoreCase("white")) return Color.white;
		}
	}
	log.info("Unable to parse body background-color (color:" + color+"). Assuming white.");
	return Color.white;
}
 
Example 8
/**
 * Convenience method to return an array of <code>Paint</code> objects that
 * represent the pre-defined colors in the <code>Color</code> and
 * <code>ChartColor</code> objects.
 *
 * @return An array of objects with the <code>Paint</code> interface.
 */
public static Paint[] createDefaultPaintArray() {

    return new Paint[] {
        new Color(0xFF, 0x55, 0x55),
        new Color(0x55, 0x55, 0xFF),
        new Color(0x55, 0xFF, 0x55),
        new Color(0xFF, 0xFF, 0x55),
        new Color(0xFF, 0x55, 0xFF),
        new Color(0x55, 0xFF, 0xFF),
        Color.pink,
        Color.gray,
        ChartColor.DARK_RED,
        ChartColor.DARK_BLUE,
        ChartColor.DARK_GREEN,
        ChartColor.DARK_YELLOW,
        ChartColor.DARK_MAGENTA,
        ChartColor.DARK_CYAN,
        Color.darkGray,
        ChartColor.LIGHT_RED,
        ChartColor.LIGHT_BLUE,
        ChartColor.LIGHT_GREEN,
        ChartColor.LIGHT_YELLOW,
        ChartColor.LIGHT_MAGENTA,
        ChartColor.LIGHT_CYAN,
        Color.lightGray,
        ChartColor.VERY_DARK_RED,
        ChartColor.VERY_DARK_BLUE,
        ChartColor.VERY_DARK_GREEN,
        ChartColor.VERY_DARK_YELLOW,
        ChartColor.VERY_DARK_MAGENTA,
        ChartColor.VERY_DARK_CYAN,
        ChartColor.VERY_LIGHT_RED,
        ChartColor.VERY_LIGHT_BLUE,
        ChartColor.VERY_LIGHT_GREEN,
        ChartColor.VERY_LIGHT_YELLOW,
        ChartColor.VERY_LIGHT_MAGENTA,
        ChartColor.VERY_LIGHT_CYAN
    };
}
 
Example 9
public static Color parseColor(String color) {
	if(color != null) {
		if(color.trim().startsWith("#")){
			// HTML colors (#FFFFFF format)
			return new Color(Integer.parseInt(color.substring(1), 16));
		}else if(color.trim().startsWith("rgb")){
			// HTML colors (rgb(255, 255, 255) format)
			String values = color.substring(color.indexOf("(") + 1, color.indexOf(")"));
			String rgb[] = values.split(",");
			return new Color(Integer.parseInt(rgb[0].trim()), Integer.parseInt(rgb[1].trim()), Integer.parseInt(rgb[2].trim()));
		}else{
			// Colors by name
			if(color.equalsIgnoreCase("black")) return Color.black;
			if(color.equalsIgnoreCase("grey")) return Color.gray;
			if(color.equalsIgnoreCase("yellow")) return Color.yellow;
			if(color.equalsIgnoreCase("green")) return Color.green;
			if(color.equalsIgnoreCase("blue")) return Color.blue;
			if(color.equalsIgnoreCase("red")) return Color.red;
			if(color.equalsIgnoreCase("orange")) return Color.orange;
			if(color.equalsIgnoreCase("cyan")) return Color.cyan;
			if(color.equalsIgnoreCase("magenta")) return Color.magenta;
			if(color.equalsIgnoreCase("darkgray")) return Color.darkGray;
			if(color.equalsIgnoreCase("lightgray")) return Color.lightGray;
			if(color.equalsIgnoreCase("pink")) return Color.pink;
			if(color.equalsIgnoreCase("white")) return Color.white;
		}
	}
	log.info("Unable to parse body background-color (color:" + color+"). Assuming white.");
	return Color.white;
}
 
Example 10
Source Project: opensim-gui   File: ChartColor.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Convenience method to return an array of <code>Paint</code> objects that
 * represent the pre-defined colors in the <code>Color<code> and 
 * <code>ChartColor</code> objects.
 *
 * @return An array of objects with the <code>Paint</code> interface.
 */
public static Paint[] createDefaultPaintArray() {

    return new Paint[] {
        //new Color(0xFF, 0x55, 0x55),
        //new Color(0x55, 0x55, 0xFF),
        //new Color(0x55, 0xFF, 0x55),
        //new Color(0xFF, 0xFF, 0x55),
        //new Color(0xFF, 0x55, 0xFF),
        //new Color(0x55, 0xFF, 0xFF),
        //Color.pink,
        //Color.gray,
        ChartColor.DARK_RED,
        ChartColor.DARK_BLUE,
        ChartColor.DARK_GREEN,
        //ChartColor.DARK_YELLOW,
        ChartColor.DARK_MAGENTA,
        ChartColor.DARK_CYAN,
        Color.darkGray,
        ChartColor.LIGHT_RED,
        //ChartColor.LIGHT_BLUE,
        //ChartColor.LIGHT_GREEN,
  Color.pink,
  ChartColor.DARK_YELLOW,
  new Color(0x55, 0x55, 0xFF),
  new Color(0xFF, 0x55, 0xFF),
        ChartColor.LIGHT_YELLOW,
        ChartColor.LIGHT_MAGENTA,
        ChartColor.LIGHT_CYAN,
        Color.lightGray,
        ChartColor.VERY_DARK_RED,
        ChartColor.VERY_DARK_BLUE,
        ChartColor.VERY_DARK_GREEN,
        ChartColor.VERY_DARK_YELLOW,
        ChartColor.VERY_DARK_MAGENTA,
        ChartColor.VERY_DARK_CYAN,
        ChartColor.VERY_LIGHT_RED,
        ChartColor.VERY_LIGHT_BLUE,
        ChartColor.VERY_LIGHT_GREEN,
        ChartColor.VERY_LIGHT_YELLOW,
        ChartColor.VERY_LIGHT_MAGENTA,
        ChartColor.VERY_LIGHT_CYAN
    };
}
 
Example 11
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
@Test
public void testEquals() {
    XYBoxAnnotation a1 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0,
            new BasicStroke(1.2f), Color.red, Color.blue);
    XYBoxAnnotation a2 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0,
            new BasicStroke(1.2f), Color.red, Color.blue);
    assertTrue(a1.equals(a2));
    assertTrue(a2.equals(a1));

    // x0
    a1 = new XYBoxAnnotation(2.0, 2.0, 3.0, 4.0, new BasicStroke(1.2f),
            Color.red, Color.blue);
    assertFalse(a1.equals(a2));
    a2 = new XYBoxAnnotation(2.0, 2.0, 3.0, 4.0, new BasicStroke(1.2f),
            Color.red, Color.blue);
    assertTrue(a1.equals(a2));

    // stroke
    a1 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f),
            Color.red, Color.blue);
    assertFalse(a1.equals(a2));
    a2 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f),
            Color.red, Color.blue);
    assertTrue(a1.equals(a2));

    GradientPaint gp1a = new GradientPaint(1.0f, 2.0f, Color.blue,
            3.0f, 4.0f, Color.red);
    GradientPaint gp1b = new GradientPaint(1.0f, 2.0f, Color.blue,
            3.0f, 4.0f, Color.red);
    GradientPaint gp2a = new GradientPaint(5.0f, 6.0f, Color.pink,
            7.0f, 8.0f, Color.white);
    GradientPaint gp2b = new GradientPaint(5.0f, 6.0f, Color.pink,
            7.0f, 8.0f, Color.white);

    // outlinePaint
    a1 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f),
            gp1a, Color.blue);
    assertFalse(a1.equals(a2));
    a2 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f),
            gp1b, Color.blue);
    assertTrue(a1.equals(a2));

    // fillPaint
    a1 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f),
            gp1a, gp2a);
    assertFalse(a1.equals(a2));
    a2 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f),
            gp1b, gp2b);
    assertTrue(a1.equals(a2));
}
 
Example 12
public static Paint getColor(Kind k) {
	switch (k) {
	case CONSTRAINTS:
		return Color.BLUE;
	case TYPESIDE:
		return Color.WHITE;
	case SCHEMA:
		return Color.GRAY;
	case INSTANCE:
		return Color.black;
	case MAPPING:
		return Color.LIGHT_GRAY;
	case TRANSFORM:
		return Color.DARK_GRAY;
	case QUERY:
		return Color.RED;
	case PRAGMA:
		return Color.GREEN;
	case GRAPH:
		return Color.YELLOW;
	case COMMENT:
		return Color.PINK;
	case SCHEMA_COLIMIT:
		return Color.ORANGE;
	case THEORY_MORPHISM:
		return Color.gray;
		
	case APG_instance:
		return Color.black;	
	case APG_typeside:
		return Color.WHITE;
	case APG_morphism:
		return Color.gray;
	case APG_mapping:
		return Color.red;
	case APG_schema:
		return Color.pink;
	default:
		break;
		
	}
	return Util.anomaly();
}
 
Example 13
public void initialize() {
  // Fonts
  this.setExtraLargeFont(new Font("Arial", Font.BOLD, 16));
  this.setLargeFont(new Font("Arial", Font.BOLD, 11));
  this.setRegularFont(new Font("Arial", Font.PLAIN, 11));
  this.setSmallFont(new Font("Arial", Font.PLAIN, 11));

  // paints
  this.setTitlePaint(Color.black);
  this.setSubtitlePaint(Color.black);
  this.setLegendItemPaint(Color.black);
  this.setPlotOutlinePaint(Color.black);
  this.setBaselinePaint(Color.black);
  this.setCrosshairPaint(Color.black);
  this.setLabelLinkPaint(Color.black);
  this.setTickLabelPaint(Color.black);
  this.setAxisLabelPaint(Color.black);
  this.setShadowPaint(Color.black);
  this.setItemLabelPaint(Color.black);

  this.setLegendBackgroundPaint(Color.white);
  this.setChartBackgroundPaint(Color.white);
  this.setPlotBackgroundPaint(Color.white);

  Paint[] colors = new Paint[] {Color.BLACK, new Color(0xFF, 0x55, 0x55),
      new Color(0x55, 0x55, 0xFF), new Color(0x55, 0xFF, 0x55), new Color(0xFF, 0xFF, 0x55),
      new Color(0xFF, 0x55, 0xFF), new Color(0x55, 0xFF, 0xFF), Color.pink, Color.gray,
      ChartColor.DARK_RED, ChartColor.DARK_BLUE, ChartColor.DARK_GREEN, ChartColor.DARK_YELLOW,
      ChartColor.DARK_MAGENTA, ChartColor.DARK_CYAN, Color.darkGray, ChartColor.LIGHT_RED,
      ChartColor.LIGHT_BLUE, ChartColor.LIGHT_GREEN, ChartColor.LIGHT_YELLOW,
      ChartColor.LIGHT_MAGENTA, ChartColor.LIGHT_CYAN, Color.lightGray, ChartColor.VERY_DARK_RED,
      ChartColor.VERY_DARK_BLUE, ChartColor.VERY_DARK_GREEN, ChartColor.VERY_DARK_YELLOW,
      ChartColor.VERY_DARK_MAGENTA, ChartColor.VERY_DARK_CYAN, ChartColor.VERY_LIGHT_RED,
      ChartColor.VERY_LIGHT_BLUE, ChartColor.VERY_LIGHT_GREEN, ChartColor.VERY_LIGHT_YELLOW,
      ChartColor.VERY_LIGHT_MAGENTA, ChartColor.VERY_LIGHT_CYAN};

  this.setDrawingSupplier(
      new DefaultDrawingSupplier(colors, DefaultDrawingSupplier.DEFAULT_FILL_PAINT_SEQUENCE,
          DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
          DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
          DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
          DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));

  this.setRangeGridlinePaint(Color.GRAY);
  this.setDomainGridlinePaint(Color.GRAY);

  this.setAxisLinePaint(Color.black);
}
 
Example 14
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {

    XYBoxAnnotation a1 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0,
            new BasicStroke(1.2f), Color.red, Color.blue);
    XYBoxAnnotation a2 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0,
            new BasicStroke(1.2f), Color.red, Color.blue);
    assertTrue(a1.equals(a2));
    assertTrue(a2.equals(a1));

    // x0
    a1 = new XYBoxAnnotation(2.0, 2.0, 3.0, 4.0, new BasicStroke(1.2f),
            Color.red, Color.blue);
    assertFalse(a1.equals(a2));
    a2 = new XYBoxAnnotation(2.0, 2.0, 3.0, 4.0, new BasicStroke(1.2f),
            Color.red, Color.blue);
    assertTrue(a1.equals(a2));

    // stroke
    a1 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f),
            Color.red, Color.blue);
    assertFalse(a1.equals(a2));
    a2 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f),
            Color.red, Color.blue);
    assertTrue(a1.equals(a2));

    GradientPaint gp1a = new GradientPaint(1.0f, 2.0f, Color.blue,
            3.0f, 4.0f, Color.red);
    GradientPaint gp1b = new GradientPaint(1.0f, 2.0f, Color.blue,
            3.0f, 4.0f, Color.red);
    GradientPaint gp2a = new GradientPaint(5.0f, 6.0f, Color.pink,
            7.0f, 8.0f, Color.white);
    GradientPaint gp2b = new GradientPaint(5.0f, 6.0f, Color.pink,
            7.0f, 8.0f, Color.white);

    // outlinePaint
    a1 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f),
            gp1a, Color.blue);
    assertFalse(a1.equals(a2));
    a2 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f),
            gp1b, Color.blue);
    assertTrue(a1.equals(a2));

    // fillPaint
    a1 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f),
            gp1a, gp2a);
    assertFalse(a1.equals(a2));
    a2 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f),
            gp1b, gp2b);
    assertTrue(a1.equals(a2));
}
 
Example 15
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
@Test
public void testEquals() {

    XYShapeAnnotation a1 = new XYShapeAnnotation(
            new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0),
            new BasicStroke(1.2f), Color.red, Color.blue);
    XYShapeAnnotation a2 = new XYShapeAnnotation(
            new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0),
            new BasicStroke(1.2f), Color.red, Color.blue);
    assertTrue(a1.equals(a2));
    assertTrue(a2.equals(a1));

    // shape
    a1 = new XYShapeAnnotation(
            new Rectangle2D.Double(4.0, 3.0, 2.0, 1.0),
            new BasicStroke(1.2f), Color.red, Color.blue);
    assertFalse(a1.equals(a2));
    a2 = new XYShapeAnnotation(
            new Rectangle2D.Double(4.0, 3.0, 2.0, 1.0),
            new BasicStroke(1.2f), Color.red, Color.blue);
    assertTrue(a1.equals(a2));

    // stroke
    a1 = new XYShapeAnnotation(
            new Rectangle2D.Double(4.0, 3.0, 2.0, 1.0),
            new BasicStroke(2.3f), Color.red, Color.blue);
    assertFalse(a1.equals(a2));
    a2 = new XYShapeAnnotation(
            new Rectangle2D.Double(4.0, 3.0, 2.0, 1.0),
            new BasicStroke(2.3f), Color.red, Color.blue);
    assertTrue(a1.equals(a2));

    GradientPaint gp1a = new GradientPaint(1.0f, 2.0f, Color.blue,
            3.0f, 4.0f, Color.red);
    GradientPaint gp1b = new GradientPaint(1.0f, 2.0f, Color.blue,
            3.0f, 4.0f, Color.red);
    GradientPaint gp2a = new GradientPaint(5.0f, 6.0f, Color.pink,
            7.0f, 8.0f, Color.white);
    GradientPaint gp2b = new GradientPaint(5.0f, 6.0f, Color.pink,
            7.0f, 8.0f, Color.white);

    // outlinePaint
    a1 = new XYShapeAnnotation(
            new Rectangle2D.Double(4.0, 3.0, 2.0, 1.0),
            new BasicStroke(2.3f), gp1a, Color.blue);
    assertFalse(a1.equals(a2));
    a2 = new XYShapeAnnotation(
            new Rectangle2D.Double(4.0, 3.0, 2.0, 1.0),
            new BasicStroke(2.3f), gp1b, Color.blue);
    assertTrue(a1.equals(a2));

    // fillPaint
    a1 = new XYShapeAnnotation(
            new Rectangle2D.Double(4.0, 3.0, 2.0, 1.0),
            new BasicStroke(2.3f), gp1a, gp2a);
    assertFalse(a1.equals(a2));
    a2 = new XYShapeAnnotation(
            new Rectangle2D.Double(4.0, 3.0, 2.0, 1.0),
            new BasicStroke(2.3f), gp1b, gp2b);
    assertTrue(a1.equals(a2));
}
 
Example 16
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
@Test
public void testEquals() {
    XYBoxAnnotation a1 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0,
            new BasicStroke(1.2f), Color.red, Color.blue);
    XYBoxAnnotation a2 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0,
            new BasicStroke(1.2f), Color.red, Color.blue);
    assertTrue(a1.equals(a2));
    assertTrue(a2.equals(a1));

    // x0
    a1 = new XYBoxAnnotation(2.0, 2.0, 3.0, 4.0, new BasicStroke(1.2f),
            Color.red, Color.blue);
    assertFalse(a1.equals(a2));
    a2 = new XYBoxAnnotation(2.0, 2.0, 3.0, 4.0, new BasicStroke(1.2f),
            Color.red, Color.blue);
    assertTrue(a1.equals(a2));

    // stroke
    a1 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f),
            Color.red, Color.blue);
    assertFalse(a1.equals(a2));
    a2 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f),
            Color.red, Color.blue);
    assertTrue(a1.equals(a2));

    GradientPaint gp1a = new GradientPaint(1.0f, 2.0f, Color.blue,
            3.0f, 4.0f, Color.red);
    GradientPaint gp1b = new GradientPaint(1.0f, 2.0f, Color.blue,
            3.0f, 4.0f, Color.red);
    GradientPaint gp2a = new GradientPaint(5.0f, 6.0f, Color.pink,
            7.0f, 8.0f, Color.white);
    GradientPaint gp2b = new GradientPaint(5.0f, 6.0f, Color.pink,
            7.0f, 8.0f, Color.white);

    // outlinePaint
    a1 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f),
            gp1a, Color.blue);
    assertFalse(a1.equals(a2));
    a2 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f),
            gp1b, Color.blue);
    assertTrue(a1.equals(a2));

    // fillPaint
    a1 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f),
            gp1a, gp2a);
    assertFalse(a1.equals(a2));
    a2 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f),
            gp1b, gp2b);
    assertTrue(a1.equals(a2));
}
 
Example 17
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    
    XYBoxAnnotation a1 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, 
    		new BasicStroke(1.2f), Color.red, Color.blue);
    XYBoxAnnotation a2 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, 
    		new BasicStroke(1.2f), Color.red, Color.blue);
    assertTrue(a1.equals(a2));
    assertTrue(a2.equals(a1));
  
    // x0
    a1 = new XYBoxAnnotation(2.0, 2.0, 3.0, 4.0, new BasicStroke(1.2f), 
    		Color.red, Color.blue);
    assertFalse(a1.equals(a2));
    a2 = new XYBoxAnnotation(2.0, 2.0, 3.0, 4.0, new BasicStroke(1.2f), 
    		Color.red, Color.blue);
    assertTrue(a1.equals(a2));
    
    // stroke
    a1 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f), 
    		Color.red, Color.blue);
    assertFalse(a1.equals(a2));
    a2 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f), 
    		Color.red, Color.blue);
    assertTrue(a1.equals(a2));
    
    GradientPaint gp1a = new GradientPaint(1.0f, 2.0f, Color.blue, 
            3.0f, 4.0f, Color.red);
    GradientPaint gp1b = new GradientPaint(1.0f, 2.0f, Color.blue, 
            3.0f, 4.0f, Color.red);
    GradientPaint gp2a = new GradientPaint(5.0f, 6.0f, Color.pink, 
            7.0f, 8.0f, Color.white);
    GradientPaint gp2b = new GradientPaint(5.0f, 6.0f, Color.pink, 
            7.0f, 8.0f, Color.white);
    
    // outlinePaint
    a1 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f), 
    		gp1a, Color.blue);
    assertFalse(a1.equals(a2));
    a2 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f), 
    		gp1b, Color.blue);
    assertTrue(a1.equals(a2));
    
    // fillPaint
    a1 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f), 
    		gp1a, gp2a);
    assertFalse(a1.equals(a2));
    a2 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f), 
    		gp1b, gp2b);
    assertTrue(a1.equals(a2));
}
 
Example 18
Source Project: SIMVA-SoS   File: XYBoxAnnotationTest.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
@Test
public void testEquals() {
    XYBoxAnnotation a1 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0,
            new BasicStroke(1.2f), Color.red, Color.blue);
    XYBoxAnnotation a2 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0,
            new BasicStroke(1.2f), Color.red, Color.blue);
    assertTrue(a1.equals(a2));
    assertTrue(a2.equals(a1));

    // x0
    a1 = new XYBoxAnnotation(2.0, 2.0, 3.0, 4.0, new BasicStroke(1.2f),
            Color.red, Color.blue);
    assertFalse(a1.equals(a2));
    a2 = new XYBoxAnnotation(2.0, 2.0, 3.0, 4.0, new BasicStroke(1.2f),
            Color.red, Color.blue);
    assertTrue(a1.equals(a2));

    // stroke
    a1 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f),
            Color.red, Color.blue);
    assertFalse(a1.equals(a2));
    a2 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f),
            Color.red, Color.blue);
    assertTrue(a1.equals(a2));

    GradientPaint gp1a = new GradientPaint(1.0f, 2.0f, Color.blue,
            3.0f, 4.0f, Color.red);
    GradientPaint gp1b = new GradientPaint(1.0f, 2.0f, Color.blue,
            3.0f, 4.0f, Color.red);
    GradientPaint gp2a = new GradientPaint(5.0f, 6.0f, Color.pink,
            7.0f, 8.0f, Color.white);
    GradientPaint gp2b = new GradientPaint(5.0f, 6.0f, Color.pink,
            7.0f, 8.0f, Color.white);

    // outlinePaint
    a1 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f),
            gp1a, Color.blue);
    assertFalse(a1.equals(a2));
    a2 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f),
            gp1b, Color.blue);
    assertTrue(a1.equals(a2));

    // fillPaint
    a1 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f),
            gp1a, gp2a);
    assertFalse(a1.equals(a2));
    a2 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(2.3f),
            gp1b, gp2b);
    assertTrue(a1.equals(a2));
}
 
Example 19
public void initialize() {
  // Fonts
  this.setExtraLargeFont(new Font("Arial", Font.BOLD, 16));
  this.setLargeFont(new Font("Arial", Font.BOLD, 11));
  this.setRegularFont(new Font("Arial", Font.PLAIN, 11));
  this.setSmallFont(new Font("Arial", Font.PLAIN, 11));

  // paints
  this.setTitlePaint(Color.black);
  this.setSubtitlePaint(Color.black);
  this.setLegendItemPaint(Color.black);
  this.setPlotOutlinePaint(Color.black);
  this.setBaselinePaint(Color.black);
  this.setCrosshairPaint(Color.black);
  this.setLabelLinkPaint(Color.black);
  this.setTickLabelPaint(Color.black);
  this.setAxisLabelPaint(Color.black);
  this.setShadowPaint(Color.black);
  this.setItemLabelPaint(Color.black);

  this.setLegendBackgroundPaint(Color.white);
  this.setChartBackgroundPaint(Color.white);
  this.setPlotBackgroundPaint(Color.white);

  Paint[] colors = new Paint[] {Color.BLACK, new Color(0xFF, 0x55, 0x55),
      new Color(0x55, 0x55, 0xFF), new Color(0x55, 0xFF, 0x55), new Color(0xFF, 0xFF, 0x55),
      new Color(0xFF, 0x55, 0xFF), new Color(0x55, 0xFF, 0xFF), Color.pink, Color.gray,
      ChartColor.DARK_RED, ChartColor.DARK_BLUE, ChartColor.DARK_GREEN, ChartColor.DARK_YELLOW,
      ChartColor.DARK_MAGENTA, ChartColor.DARK_CYAN, Color.darkGray, ChartColor.LIGHT_RED,
      ChartColor.LIGHT_BLUE, ChartColor.LIGHT_GREEN, ChartColor.LIGHT_YELLOW,
      ChartColor.LIGHT_MAGENTA, ChartColor.LIGHT_CYAN, Color.lightGray, ChartColor.VERY_DARK_RED,
      ChartColor.VERY_DARK_BLUE, ChartColor.VERY_DARK_GREEN, ChartColor.VERY_DARK_YELLOW,
      ChartColor.VERY_DARK_MAGENTA, ChartColor.VERY_DARK_CYAN, ChartColor.VERY_LIGHT_RED,
      ChartColor.VERY_LIGHT_BLUE, ChartColor.VERY_LIGHT_GREEN, ChartColor.VERY_LIGHT_YELLOW,
      ChartColor.VERY_LIGHT_MAGENTA, ChartColor.VERY_LIGHT_CYAN};

  this.setDrawingSupplier(
      new DefaultDrawingSupplier(colors, DefaultDrawingSupplier.DEFAULT_FILL_PAINT_SEQUENCE,
          DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
          DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
          DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
          DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));

  this.setRangeGridlinePaint(Color.GRAY);
  this.setDomainGridlinePaint(Color.GRAY);

  this.setAxisLinePaint(Color.black);
}
 
Example 20
Source Project: FCMFrame   File: CCPolygon.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Create a polygon from a set of points. A polygon needs more than two
 * points.
 * <p>
 * The edges will be painted in black with a 1 pixel thick edge. The
 * interior of the polygon will be filled in pink.
 * 
 * @param xpoints
 *        x-coordinates for the points that form the polygon.
 * @param ypoints
 *        y-coordinates for the points that form the polygon.
 */
public CCPolygon(double [] xpoints, double [] ypoints) {
    this(xpoints, ypoints, Color.black, Color.pink, new BasicStroke(1f));
}