Example usage for java.awt Color BLACK

List of usage examples for java.awt Color BLACK

Introduction

In this page you can find the example usage for java.awt Color BLACK.

Prototype

Color BLACK

To view the source code for java.awt Color BLACK.

Click Source Link

Document

The color black.

Usage

From source file:com.itemanalysis.jmetrik.swing.JmetrikXYLineAndShapeRenderer.java

public Paint getItemPaint(int row, int col) {
    Paint[] altColors = { Color.BLACK, ChartColor.RED, ChartColor.DARK_BLUE, ChartColor.DARK_GREEN,
            ChartColor.DARK_MAGENTA, ChartColor.DARK_CYAN, ChartColor.LIGHT_RED, ChartColor.LIGHT_BLUE,
            ChartColor.LIGHT_GREEN, ChartColor.LIGHT_MAGENTA, ChartColor.LIGHT_CYAN, 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_MAGENTA,
            ChartColor.VERY_LIGHT_CYAN };

    return altColors[row];
}

From source file:jasperreport.BarChartCustomizer.java

public void customize(JFreeChart chart, JRChart jasperChart) {
    BarRenderer renderer = (BarRenderer) chart.getCategoryPlot().getRenderer();
    renderer.setSeriesPaint(0, Color.BLACK);
    renderer.setSeriesPaint(1, Color.orange);
    renderer.setBaseItemLabelsVisible(true);
}

From source file:com.quartercode.disconnected.util.LocationGenerator.java

/**
 * Generates the given amount of locations on an earth map, ignoring the given ignore locations.
 * /*from  ww w .java2s. com*/
 * @param amount The amount of locations to generate.
 * @return The generated locations.
 * @throws RuntimeException The map image can't be read.
 */
public static List<Location> generateLocations(int amount, List<Location> ignore) {

    Validate.isTrue(amount > 0, "Generation amount must be > 0: ", amount);

    if (map == null) {
        try {
            map = ImageIO.read(LocationGenerator.class.getResource("/data/map.png"));
        } catch (IOException e) {
            throw new RuntimeException("Can't read map data image", e);
        }
    }

    if (ignore == null) {
        ignore = new ArrayList<Location>();
    }

    int width = map.getWidth();
    int height = map.getHeight();

    List<Location> result = new ArrayList<Location>();
    RandomPool random = new RandomPool(100);
    int blackRGB = Color.BLACK.getRGB();
    while (result.size() < amount) {
        int x = random.nextInt(width);
        int y = random.nextInt(height);
        if (map.getRGB(x, y) == blackRGB) {
            Location location = new Location((float) x / (float) width, (float) y / (float) height);
            if (!ignore.contains(location) && !result.contains(location)) {
                result.add(location);
            }
        }
    }

    return result;
}

From source file:Interfaz.XYLineChart.java

/** Constructor de clase 
* @param d Dimension/*from  w  w  w.j  av a  2s.c om*/
*/
public XYLineChart(Dimension d, ArrayList<Restriccion> rest, ArrayList<Coordenada> cor) {

    //se declara el grafico XY Lineal
    XYDataset xydataset = xyDataset(rest, cor);
    JFreeChart jfreechart = ChartFactory.createXYLineChart("Graficas lineales", "X", "Y", xydataset,
            PlotOrientation.VERTICAL, true, true, false);

    //personalizacin del grafico
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setBackgroundPaint(Color.white);
    xyplot.setDomainGridlinePaint(Color.BLACK);
    xyplot.setRangeGridlinePaint(Color.BLACK);

    // -> Pinta Shapes en los puntos dados por el XYDataset
    //        XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
    //        xylineandshaperenderer.setBaseShapesVisible(true);
    //        //--> muestra los valores de cada punto XY
    //        XYItemLabelGenerator xy = new StandardXYItemLabelGenerator();
    //        xylineandshaperenderer.setBaseItemLabelGenerator( xy );
    //        xylineandshaperenderer.setBaseItemLabelsVisible(true);
    //        xylineandshaperenderer.setBaseLinesVisible(true);
    //        xylineandshaperenderer.setBaseItemLabelsVisible(true);                
    //fin de personalizacin

    //se crea la imagen y se asigna a la clase ImageIcon
    BufferedImage bufferedImage = jfreechart.createBufferedImage(d.width, d.height);
    this.setImage(bufferedImage);
}

From source file:Sketch.java

public Sketch() {
    super(true);//from   w  w  w  . j a va 2 s  .co m

    setLayout(new BorderLayout());
    board = new JPanel(true);
    board.setPreferredSize(new Dimension(300, 300));
    board.setBorder(new LineBorder(Color.black, 5));

    clear = new JButton("Clear Drawing Area");
    clear.addActionListener(this);

    shuttle1 = new JogShuttle(0, 300, 150);
    lastX = shuttle1.getValue();
    shuttle2 = new JogShuttle(0, 300, 150);
    lastY = shuttle2.getValue();

    shuttle1.setValuePerRevolution(100);
    shuttle2.setValuePerRevolution(100);

    shuttle1.addPropertyChangeListener(this);
    shuttle2.addPropertyChangeListener(this);

    shuttle1.setBorder(new BevelBorder(BevelBorder.RAISED));
    shuttle2.setBorder(new BevelBorder(BevelBorder.RAISED));

    add(board, BorderLayout.NORTH);
    add(shuttle1, BorderLayout.WEST);
    add(clear, BorderLayout.CENTER);
    add(shuttle2, BorderLayout.EAST);
}

From source file:JapaneseCalendar.java

public void paintComponent(Graphics g) {
    int width = 400;
    int height = 400;

    Calendar cal = Calendar.getInstance(locale);
    cal.setTime(new Date());

    String header = cal.getDisplayName(Calendar.MONTH, Calendar.LONG, locale);
    header += " " + cal.get(Calendar.YEAR);

    FontMetrics fm = g.getFontMetrics();
    Insets insets = getInsets();/*from www .ja  v a2s  .  c o m*/
    g.setColor(Color.black);
    g.drawString(header, (width - fm.stringWidth(header)) / 2, insets.top + fm.getHeight());

    DateFormatSymbols dfs = new DateFormatSymbols(locale);
    String[] weekdayNames = dfs.getShortWeekdays();
    int fieldWidth = (width - insets.left - insets.right) / 7;
    g.drawString(weekdayNames[Calendar.SUNDAY],
            insets.left + (fieldWidth - fm.stringWidth(weekdayNames[Calendar.SUNDAY])) / 2,
            insets.top + 3 * fm.getHeight());
    g.drawString(weekdayNames[Calendar.MONDAY],
            insets.left + fieldWidth + (fieldWidth - fm.stringWidth(weekdayNames[Calendar.MONDAY])) / 2,
            insets.top + 3 * fm.getHeight());
    g.drawString(weekdayNames[Calendar.TUESDAY],
            insets.left + 2 * fieldWidth + (fieldWidth - fm.stringWidth(weekdayNames[Calendar.TUESDAY])) / 2,
            insets.top + 3 * fm.getHeight());
    g.drawString(weekdayNames[Calendar.WEDNESDAY],
            insets.left + 3 * fieldWidth + (fieldWidth - fm.stringWidth(weekdayNames[Calendar.WEDNESDAY])) / 2,
            insets.top + 3 * fm.getHeight());
    g.drawString(weekdayNames[Calendar.THURSDAY],
            insets.left + 4 * fieldWidth + (fieldWidth - fm.stringWidth(weekdayNames[Calendar.THURSDAY])) / 2,
            insets.top + 3 * fm.getHeight());
    g.drawString(weekdayNames[Calendar.FRIDAY],
            insets.left + 5 * fieldWidth + (fieldWidth - fm.stringWidth(weekdayNames[Calendar.FRIDAY])) / 2,
            insets.top + 3 * fm.getHeight());
    g.drawString(weekdayNames[Calendar.SATURDAY],
            insets.left + 6 * fieldWidth + (fieldWidth - fm.stringWidth(weekdayNames[Calendar.SATURDAY])) / 2,
            insets.top + 3 * fm.getHeight());

    int dom = cal.get(Calendar.DAY_OF_MONTH);
    cal.set(Calendar.DAY_OF_MONTH, 1);
    int col = 0;
    switch (cal.get(Calendar.DAY_OF_WEEK)) {
    case Calendar.MONDAY:
        col = 1;
        break;

    case Calendar.TUESDAY:
        col = 2;
        break;

    case Calendar.WEDNESDAY:
        col = 3;
        break;

    case Calendar.THURSDAY:
        col = 4;
        break;

    case Calendar.FRIDAY:
        col = 5;
        break;

    case Calendar.SATURDAY:
        col = 6;
    }
    cal.set(Calendar.DAY_OF_MONTH, dom);

    int row = 5 * fm.getHeight();
    for (int i = 1; i <= cal.getActualMaximum(Calendar.DAY_OF_MONTH); i++) {
        g.drawString("" + i, insets.left + fieldWidth * col + (fieldWidth - fm.stringWidth("" + i)) / 2, row);
        if (++col > 6) {
            col = 0;
            row += fm.getHeight();
        }
    }
}

From source file:ButtonwithImageIcon.java

public void paintIcon(Component c, Graphics g, int x, int y) {
    g.setColor(Color.black);
    g.fillRect(x, y, getIconWidth(), getIconHeight());
    g.setColor(color);/*from  ww  w.ja v a 2 s .  com*/
    g.fillRect(x + borderWidth, y + borderWidth, getIconWidth() - 2 * borderWidth,
            getIconHeight() - 2 * borderWidth);
}

From source file:SaveYourDrawingToFile.java

public void paint(Graphics g) {
    g.setColor(Color.white);/*www .ja va 2 s  . c o m*/
    g.fillRect(0, 0, getSize().width, getSize().height);

    g.setColor(Color.black);
    int i = 0;
    while (i < displayList.size()) {
        Point p0 = (Point) (displayList.get(i++));
        Point p1 = (Point) (displayList.get(i++));
        int x = Math.min(p0.x, p1.x);
        int y = Math.min(p0.y, p1.y);
        int w = Math.abs(p0.x - p1.x);
        int h = Math.abs(p0.y - p1.y);
        g.drawRect(x, y, w, h);
    }
}

From source file:de.bund.bfr.jung.JungUtils.java

public static <V, E> Transformer<V, Paint> newNodeDrawTransformer(RenderContext<V, E> renderContext) {
    return node -> renderContext.getPickedVertexState().isPicked(node) ? Color.BLUE : Color.BLACK;
}

From source file:TabPanelwithImageIconCustom.java

public void paintIcon(Component c, Graphics g, int x, int y) {
    g.setColor(Color.black);
    g.fillRect(x + 4, y + 4, getIconWidth() - 8, getIconHeight() - 8);
    g.setColor(Color.cyan);/*from w w  w.  java2  s  .c  o m*/
    g.fillRect(x + 6, y + 6, getIconWidth() - 12, getIconHeight() - 12);
}