Example usage for java.awt Color darkGray

List of usage examples for java.awt Color darkGray

Introduction

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

Prototype

Color darkGray

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

Click Source Link

Document

The color dark gray.

Usage

From source file:se.technipelago.weather.chart.Generator.java

private void createTemperatureDial(float temperature, int humidity, final String filename) throws IOException {
    ValueDataset dataset1 = new DefaultValueDataset(temperature);
    ValueDataset dataset2 = new DefaultValueDataset(humidity);

    // get data for diagrams
    DialPlot plot = new DialPlot();
    plot.setView(0.0, 0.0, 1.0, 1.0);/*from w  w  w  .ja  v  a 2s .c o  m*/
    plot.setDataset(0, dataset1);
    plot.setDataset(1, dataset2);
    StandardDialFrame dialFrame = new StandardDialFrame();
    dialFrame.setBackgroundPaint(Color.lightGray);
    dialFrame.setForegroundPaint(Color.darkGray);
    plot.setDialFrame(dialFrame);

    GradientPaint gp = new GradientPaint(new Point(), new Color(255, 255, 255), new Point(),
            new Color(170, 170, 220));
    DialBackground db = new DialBackground(gp);
    db.setGradientPaintTransformer(new StandardGradientPaintTransformer(GradientPaintTransformType.VERTICAL));
    plot.setBackground(db);

    // Temperature
    DialTextAnnotation annotation1 = new DialTextAnnotation("\u00B0C");
    annotation1.setFont(new Font("Dialog", Font.BOLD, 10));
    annotation1.setRadius(0.76);

    plot.addLayer(annotation1);

    // Humidity
    DialTextAnnotation annotation2 = new DialTextAnnotation("%");
    annotation2.setFont(new Font("Dialog", Font.BOLD, 10));
    annotation2.setPaint(Color.blue);
    annotation2.setRadius(0.4);

    plot.addLayer(annotation2);

    // Temperature
    DialValueIndicator dvi = new DialValueIndicator(0);
    dvi.setFont(new Font("Dialog", Font.PLAIN, 9));
    dvi.setOutlinePaint(Color.darkGray);
    //dvi.setBackgroundPaint(new Color(0xee, 0xee, 0xf6));
    NumberFormat fmt = new DecimalFormat("#");
    fmt.setMaximumFractionDigits(1);
    fmt.setMinimumIntegerDigits(1);
    dvi.setNumberFormat(fmt);
    dvi.setRadius(0.71);
    dvi.setAngle(-88.0); // -103
    dvi.setInsets(new RectangleInsets(0.0, 8.0, 0.0, 2.0)); // top, left, bottom, right
    plot.addLayer(dvi);

    StandardDialScale scale = new StandardDialScale(-30, 30, -120, -300, 5, 4);
    scale.setTickRadius(0.88);
    scale.setTickLabelOffset(0.15);
    scale.setTickLabelFont(new Font("Dialog", Font.PLAIN, 10));
    NumberFormat fmt3 = new DecimalFormat("#");
    fmt3.setMaximumFractionDigits(0);
    scale.setTickLabelFormatter(fmt3);
    plot.addScale(0, scale);

    // Humidity
    DialValueIndicator dvi2 = new DialValueIndicator(1);
    dvi2.setFont(new Font("Dialog", Font.PLAIN, 9));
    dvi2.setOutlinePaint(Color.blue);
    //dvi2.setBackgroundPaint(new Color(0xee, 0xee, 0xf6));
    NumberFormat fmt2 = new DecimalFormat("#");
    fmt2.setMaximumFractionDigits(0);
    dvi2.setNumberFormat(fmt2);

    dvi2.setRadius(0.59);
    dvi2.setAngle(-90.0); // -77
    dvi2.setInsets(new RectangleInsets(0.0, 1.0, 0.0, 1.0));
    plot.addLayer(dvi2);

    StandardDialScale scale2 = new StandardDialScale(0, 100, -120, -300, 10, 4);
    scale2.setTickRadius(0.50);
    scale2.setTickLabelOffset(0.15);
    scale2.setTickLabelFont(new Font("Dialog", Font.PLAIN, 9));
    scale2.setTickLabelFormatter(fmt3);
    scale2.setMajorTickPaint(Color.blue);
    plot.addScale(1, scale2);
    plot.mapDatasetToScale(1, 1);

    // Add needles.
    // To make the temperature needle the front-most needle,
    // it must be added after humidity needle.
    // Humidity needle.
    DialPointer needle2 = new DialPointer.Pin(1);
    needle2.setRadius(0.50);
    plot.addLayer(needle2);

    // Temperature needle.
    DialPointer needle = new DialPointer.Pointer(0);
    Color darkGreen = new Color(0x15, 0x49, 0x1f);
    ((DialPointer.Pointer) needle).setFillPaint(darkGreen);
    plot.addLayer(needle);

    // Add a cap at the dial center.
    DialCap cap = new DialCap();
    cap.setRadius(0.10);
    plot.setCap(cap);

    JFreeChart chart = new JFreeChart(plot);
    //TextTitle title = new TextTitle("Temperatur/luftfuktighet", new Font("Dialog", Font.BOLD, 12));
    //title.setPaint(Color.DARK_GRAY);
    //chart.setTitle(title);
    chart.setBackgroundPaint(VERY_LIGHT_GRAY);

    OutputStream out = null;
    try {
        out = new FileOutputStream(outputDir != null ? outputDir + "/" + filename : filename);
        ChartUtilities.writeChartAsPNG(out, chart, DIAL_WIDTH, DIAL_HEIGHT);
    } finally {
        if (out != null) {
            out.close();
        }
    }
}

From source file:net.geoprism.dashboard.DashboardMap.java

/**
 * Builds an image layer of all the layers in a SavedMap.
 * // w w  w .  j a v  a  2 s.co  m
 * @mapWidth
 * @mapHeight
 */
private BufferedImage getLegendExportCanvas(int mapWidth, int mapHeight) {
    int padding = 2;
    BufferedImage base = null;
    Graphics mapBaseGraphic = null;
    Color innerBackgroundColor = Color.darkGray;
    Color outerBorderColor = Color.black;
    int legendTopPlacement = 0;
    int legendLeftPlacement = 0;
    int widestLegend = 0;
    int legendXPosition = 0;
    int legendYPosition = 0;

    List<? extends DashboardLayer> layers = this.getAllHasLayer().getAll();

    try {
        base = new BufferedImage(mapWidth, mapHeight, BufferedImage.TYPE_INT_ARGB);
        mapBaseGraphic = base.getGraphics();
        mapBaseGraphic.drawImage(base, 0, 0, null);

        // Generates map overlays and combines them into a single map image
        for (DashboardLayer layer : layers) {
            if (layer.getDisplayInLegend()) {
                Graphics2D titleBaseGraphic = null;
                Graphics2D iconGraphic = null;

                String requestURL = getLegendURL(layer);

                try {
                    // handle color graphics and categories
                    BufferedImage titleBase = getLegendTitleImage(layer);
                    titleBaseGraphic = titleBase.createGraphics();
                    int paddedTitleWidth = titleBase.getWidth();
                    int paddedTitleHeight = titleBase.getHeight();

                    BufferedImage icon = getImageFromGeoserver(requestURL);
                    int iconHeight = icon.getHeight();
                    int iconWidth = icon.getWidth();
                    int paddedIconWidth = iconWidth + (padding * 2);
                    int paddedIconHeight = iconHeight + (padding * 2);

                    int fullWidth = paddedIconWidth + paddedTitleWidth;
                    int fullHeight;
                    if (paddedIconHeight >= paddedTitleHeight) {
                        fullHeight = paddedIconHeight;
                    } else {
                        fullHeight = paddedTitleHeight;
                    }

                    DashboardLegend legend = layer.getDashboardLegend();
                    if (legend.getGroupedInLegend()) {
                        if (legendTopPlacement + fullHeight >= mapHeight) {
                            legendLeftPlacement = widestLegend + legendLeftPlacement + padding;
                            legendTopPlacement = 0; // reset so 2nd column legends start at the top row
                        }
                        legendXPosition = legendLeftPlacement + padding;
                        legendYPosition = legendTopPlacement + padding;
                    } else {
                        legendXPosition = (int) Math.round((double) legend.getLegendXPosition());
                        legendYPosition = (int) Math.round((double) legend.getLegendYPosition());
                    }

                    BufferedImage legendBase = new BufferedImage(fullWidth + (padding * 2),
                            fullHeight + (padding * 2), BufferedImage.TYPE_INT_ARGB);
                    Graphics2D legendBaseGraphic = legendBase.createGraphics();
                    legendBaseGraphic.setColor(innerBackgroundColor);
                    legendBaseGraphic.fillRect(0, 0, fullWidth, fullHeight);
                    legendBaseGraphic.setColor(outerBorderColor);
                    legendBaseGraphic.setStroke(new BasicStroke(5));
                    legendBaseGraphic.drawRect(0, 0, fullWidth, fullHeight);

                    legendBaseGraphic.drawImage(icon, padding, padding, paddedIconWidth, paddedIconHeight,
                            null);
                    legendBaseGraphic.drawImage(titleBase, paddedIconWidth + (padding * 2),
                            (fullHeight / 2) - (paddedTitleHeight / 2), paddedTitleWidth, paddedTitleHeight,
                            null);
                    mapBaseGraphic.drawImage(legendBase, legendXPosition, legendYPosition, fullWidth,
                            fullHeight, null);

                    if (legend.getGroupedInLegend()) {
                        legendTopPlacement = legendTopPlacement + fullHeight + padding;
                    }

                    if (fullWidth > widestLegend) {
                        widestLegend = fullWidth;
                    }
                } finally {
                    if (titleBaseGraphic != null) {
                        titleBaseGraphic.dispose();
                    }

                    if (iconGraphic != null) {
                        iconGraphic.dispose();
                    }
                }
            }
        }
    } finally {
        mapBaseGraphic.dispose();
    }

    return base;
}

From source file:se.technipelago.weather.chart.Generator.java

private void createWindDial(float speed, float high, final String filename) throws IOException {
    ValueDataset dataset1 = new DefaultValueDataset(speed);
    ValueDataset dataset2 = new DefaultValueDataset(high);

    // get data for diagrams
    DialPlot plot = new DialPlot();
    plot.setView(0.0, 0.0, 1.0, 1.0);/*from  w ww . ja v a  2 s  .com*/
    plot.setDataset(0, dataset1);
    plot.setDataset(1, dataset2);
    StandardDialFrame dialFrame = new StandardDialFrame();
    dialFrame.setBackgroundPaint(Color.lightGray);
    dialFrame.setForegroundPaint(Color.darkGray);
    plot.setDialFrame(dialFrame);

    GradientPaint gp = new GradientPaint(new Point(), new Color(255, 255, 255), new Point(),
            new Color(170, 170, 220));
    DialBackground db = new DialBackground(gp);
    db.setGradientPaintTransformer(new StandardGradientPaintTransformer(GradientPaintTransformType.VERTICAL));
    plot.setBackground(db);

    // Wind Speed
    DialTextAnnotation annotation1 = new DialTextAnnotation("m/s");
    annotation1.setFont(new Font("Dialog", Font.BOLD, 10));
    annotation1.setRadius(0.76);

    plot.addLayer(annotation1);

    DialValueIndicator dvi = new DialValueIndicator(0);
    dvi.setFont(new Font("Dialog", Font.PLAIN, 9));
    dvi.setOutlinePaint(Color.darkGray);
    //dvi.setBackgroundPaint(new Color(0xee, 0xee, 0xf6));
    NumberFormat fmt = new DecimalFormat("#");
    fmt.setMaximumFractionDigits(1);
    fmt.setMinimumIntegerDigits(1);
    dvi.setNumberFormat(fmt);
    dvi.setRadius(0.71);
    dvi.setAngle(-89.0); // -103
    dvi.setInsets(new RectangleInsets(0.0, 2.0, 0.0, 2.0)); // top, left, bottom, right
    plot.addLayer(dvi);

    StandardDialScale scale = new StandardDialScale(0, 20, -120, -300, 1, 0);
    scale.setTickRadius(0.88);
    scale.setTickLabelOffset(0.15);
    scale.setTickLabelFont(new Font("Dialog", Font.PLAIN, 10));
    NumberFormat fmt3 = new DecimalFormat("#");
    fmt3.setMaximumFractionDigits(0);
    scale.setTickLabelFormatter(fmt3);
    plot.addScale(0, scale);

    // Add needles.
    // To make the average speed needle the front-most needle,
    // it must be added after high speed needle.
    // High speed needle.
    DialPointer needle2 = new DialPointer.Pin(1);
    needle2.setRadius(0.62);
    plot.addLayer(needle2);

    // Average speed needle.
    DialPointer needle = new DialPointer.Pointer(0);
    Color darkGreen = new Color(0x15, 0x49, 0x1f);
    ((DialPointer.Pointer) needle).setFillPaint(darkGreen);
    plot.addLayer(needle);

    // Add a cap at the dial center.
    DialCap cap = new DialCap();
    cap.setRadius(0.10);
    plot.setCap(cap);

    JFreeChart chart = new JFreeChart(plot);
    //TextTitle title = new TextTitle("Vindhastighet", new Font("Dialog", Font.BOLD, 12));
    //title.setPaint(Color.DARK_GRAY);
    //chart.setTitle(title);
    chart.setBackgroundPaint(VERY_LIGHT_GRAY);

    OutputStream out = null;
    try {
        out = new FileOutputStream(outputDir != null ? outputDir + "/" + filename : filename);
        ChartUtilities.writeChartAsPNG(out, chart, DIAL_WIDTH, DIAL_HEIGHT);
    } finally {
        if (out != null) {
            out.close();
        }
    }
}

From source file:net.sf.jasperreports.engine.xml.JRXmlConstants.java

/**
 * @deprecated Replaced by {@link ColorEnum}.
 *///from  www  . j  ava  2 s  .  c  o m
public static Map getColorMap() {
    if (colorMap == null) {
        Map map = new HashMap(35);
        map.put(COLOR_BLACK, Color.black);
        map.put(COLOR_BLUE, Color.blue);
        map.put(COLOR_CYAN, Color.cyan);
        map.put(COLOR_DARK_GRAY, Color.darkGray);
        map.put(COLOR_GRAY, Color.gray);
        map.put(COLOR_GREEN, Color.green);
        map.put(COLOR_LIGHT_GRAY, Color.lightGray);
        map.put(COLOR_MAGENTA, Color.magenta);
        map.put(COLOR_ORANGE, Color.orange);
        map.put(COLOR_PINK, Color.pink);
        map.put(COLOR_RED, Color.red);
        map.put(COLOR_YELLOW, Color.yellow);
        map.put(COLOR_WHITE, Color.white);
        map.put(Color.black, COLOR_BLACK);
        map.put(Color.blue, COLOR_BLUE);
        map.put(Color.cyan, COLOR_CYAN);
        map.put(Color.darkGray, COLOR_DARK_GRAY);
        map.put(Color.gray, COLOR_GRAY);
        map.put(Color.green, COLOR_GREEN);
        map.put(Color.lightGray, COLOR_LIGHT_GRAY);
        map.put(Color.magenta, COLOR_MAGENTA);
        map.put(Color.orange, COLOR_ORANGE);
        map.put(Color.pink, COLOR_PINK);
        map.put(Color.red, COLOR_RED);
        map.put(Color.yellow, COLOR_YELLOW);
        map.put(Color.white, COLOR_WHITE);
        colorMap = Collections.unmodifiableMap(map);
    }

    return colorMap;
}

From source file:org.sakaiproject.sitestats.impl.chart.ChartServiceImpl.java

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 {//from  ww  w.j a va 2s.c om
            // 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;
}

From source file:org.sakaiproject.sitestats.impl.ServerWideReportManagerImpl.java

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 {/*w  w  w .j  a v a  2 s. co m*/
            // 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;
}

From source file:base.BasePlayer.ClusterTable.java

void drawHeader() {
    for (int i = 0; i < header.size(); i++) {
        buf.setColor(Color.darkGray);
        buf.fillRect((int) header.get(i)[1], 0, (int) (header.get(i)[2]) + 1, rowHeight);

        if (mouseY - tablescroll.getVerticalScrollBar().getValue() <= rowHeight) {
            if (mouseX >= (int) ((int) header.get(i)[1])
                    && mouseX <= (int) ((int) header.get(i)[1]) + (int) (header.get(i)[2])) {
                headerHover = i;/*from ww w . j a v  a 2 s  . co m*/
                buf.setColor(Color.yellow);
            } else if (mouseX >= (int) (header.get(header.size() - 1)[1])
                    + (int) (header.get(header.size() - 1)[2])) {
                headerHover = header.size();
                buf.setColor(Color.white);
            } else {
                buf.setColor(Color.white);
            }
        } else {

            buf.setColor(Color.white);
        }
        if (!mouseDrag && headerHover > -1 && i > 0 && i < header.size()) {
            if (mouseX > (int) ((int) header.get(i)[1]) - 5 && mouseX < (int) ((int) header.get(i)[1]) + 5) {
                resizeColumn = i;

            }
        }
        if (header.get(i)[0] instanceof String) {
            buf.drawString((String) header.get(i)[0], (int) ((int) header.get(i)[1]) + 4, rowHeight - 2);
        } else if (header.get(i)[0] instanceof BedTrack) {
            BedTrack track = (BedTrack) header.get(i)[0];

            if (track.file != null) {
                buf.drawString(track.file.getName(), (int) ((int) header.get(i)[1]) + 4, rowHeight - 2);
            } else {
                buf.drawString(FilenameUtils.getName(track.url.getFile()), (int) ((int) header.get(i)[1]) + 4,
                        rowHeight - 2);
            }
            track = null;
        }

        buf.setColor(Color.black);
        buf.drawLine((int) ((int) header.get(i)[1]), 0, (int) ((int) header.get(i)[1]), rowHeight);
        if (sorter.index > -1) {
            if (sorter.ascending) {
                buf.setColor(Color.white);
                buf.fillPolygon(this.sortTriangle);
            } else {
                buf.setColor(Color.white);
                buf.fillPolygon(this.sortTriangle);
            }
        }
    }
    buf.setColor(Color.darkGray);
    buf.fillRect((int) header.get(header.size() - 1)[1] + (int) header.get(header.size() - 1)[2] + 2, 0,
            this.width, rowHeight);
    buf.setColor(Color.black);
    buf.drawLine((int) header.get(header.size() - 1)[1] + (int) header.get(header.size() - 1)[2] + 1, 0,
            (int) header.get(header.size() - 1)[1] + (int) header.get(header.size() - 1)[2] + 1, rowHeight);
    if (!mouseDrag && headerHover > -1 && resizeColumn == -1) {

        if (mouseX > ((int) header.get(header.size() - 1)[1] + (int) header.get(header.size() - 1)[2]) - 5
                && mouseX < ((int) header.get(header.size() - 1)[1] + (int) header.get(header.size() - 1)[2])
                        + 5) {
            resizeColumn = header.size();

        }
    }

}

From source file:base.BasePlayer.AminoTable.java

void drawHeader() {
    for (int i = 0; i < header.length; i++) {
        buf.setColor(Color.darkGray);
        buf.fillRect((int) (headerlengths[i][0]), 0, (int) (headerlengths[i][1]) + 1, rowHeight);

        if (mouseY - tablescroll.getVerticalScrollBar().getValue() <= rowHeight) {
            if (mouseX >= (int) (headerlengths[i][0])
                    && mouseX <= (int) (headerlengths[i][0]) + (int) (headerlengths[i][1])) {
                headerHover = i;//from   ww  w  . j av a  2  s. c  o m
                buf.setColor(Color.yellow);
            } else if (mouseX >= (int) (headerlengths[headerlengths.length - 1][0])
                    + (int) (headerlengths[headerlengths.length - 1][1])) {
                headerHover = headerlengths.length;
                buf.setColor(Color.white);
            } else {
                buf.setColor(Color.white);
            }

        } else {

            buf.setColor(Color.white);
        }
        if (!mouseDrag && headerHover > -1 && i > 0 && i < header.length) {
            if (mouseX > (int) (headerlengths[i][0]) - 5 && mouseX < (int) (headerlengths[i][0]) + 5) {
                resizeColumn = i;

            }
        }
        buf.drawString(header[i], (int) (headerlengths[i][0]) + 4, rowHeight - 2);
        buf.setColor(Color.black);
        buf.drawLine((int) (headerlengths[i][0]), 0, (int) (headerlengths[i][0]), rowHeight);
        if (sorter.index > -1) {
            if (sorter.ascending) {
                buf.setColor(Color.white);
                buf.fillPolygon(this.sortTriangle);
            } else {
                buf.setColor(Color.white);
                buf.fillPolygon(this.sortTriangle);
            }
        }
    }
    buf.setColor(Color.darkGray);
    buf.fillRect((int) headerlengths[header.length - 1][0] + (int) headerlengths[header.length - 1][1] + 2, 0,
            this.width, rowHeight);
    buf.setColor(Color.black);
    buf.drawLine((int) headerlengths[header.length - 1][0] + (int) headerlengths[header.length - 1][1] + 1, 0,
            (int) headerlengths[header.length - 1][0] + (int) headerlengths[header.length - 1][1] + 1,
            rowHeight);
    if (!mouseDrag && headerHover > -1 && resizeColumn == -1) {

        if (mouseX > (int) ((int) headerlengths[header.length - 1][0]
                + (int) headerlengths[header.length - 1][1]) - 5
                && mouseX < ((int) headerlengths[header.length - 1][0]
                        + (int) headerlengths[header.length - 1][1]) + 5) {
            resizeColumn = header.length;

        }
    }

}

From source file:base.BasePlayer.BedTable.java

void drawGeneheader(int y) {
    for (int i = 0; i < geneheader.size(); i++) {
        buf.setColor(Color.darkGray);
        buf.fillRect((int) ((int) geneheader.get(i)[1]) + 10, y, (int) geneheader.get(i)[2], rowHeight);

        if (mouseY - tablescroll.getVerticalScrollBar().getValue() <= y + rowHeight
                && mouseY - tablescroll.getVerticalScrollBar().getValue() >= y) {

            if (mouseX >= (int) geneheader.get(i)[1] + 10
                    && mouseX <= (int) geneheader.get(i)[1] + (int) geneheader.get(i)[2] + 10) {

                geneHeaderHover = i;/*from  ww  w .  j  av a 2  s.c o m*/
                buf.setColor(Color.yellow);
            } else if (mouseX >= (int) geneheader.get(geneheader.size() - 1)[1]
                    + (int) geneheader.get(geneheader.size() - 1)[2] + 10) {
                geneHeaderHover = geneheader.size();
                buf.setColor(Color.white);
            } else {
                buf.setColor(Color.white);
            }

        } else {

            buf.setColor(Color.white);
        }
        if (!mouseDrag && geneHeaderHover > -1 && i > 0 && i < geneheader.size()) {
            if (mouseX > (int) geneheader.get(i)[1] + 5 && mouseX < (int) geneheader.get(i)[1] + 15) {
                if (resizeColumn != i) {
                    resizeColumn = i;
                }
            }
        }

        if (geneheader.get(i)[0] instanceof String) {
            buf.drawString((String) geneheader.get(i)[0], (int) geneheader.get(i)[1] + 14, y + rowHeight - 3);
        } else if (geneheader.get(i)[0] instanceof ControlFile) {
            ControlFile ctrlfile = (ControlFile) geneheader.get(i)[0];
            buf.drawString("AF: " + ctrlfile.getName(), (int) geneheader.get(i)[1] + 14, y + rowHeight - 3);
            ctrlfile = null;
        } else {
            BedTrack track = (BedTrack) geneheader.get(i)[0];

            if (track.file != null) {
                buf.drawString(track.file.getName(), (int) geneheader.get(i)[1] + 14, y + rowHeight - 3);
            } else {
                buf.drawString(FilenameUtils.getName(track.url.getFile()), (int) geneheader.get(i)[1] + 14,
                        y + rowHeight - 3);
            }
            track = null;
        }
        buf.setColor(Color.black);
        buf.drawLine((int) geneheader.get(i)[1] + 10, y, (int) ((int) geneheader.get(i)[1]) + 10,
                y + rowHeight);

    }

    if (!mouseDrag && geneHeaderHover > -1 && resizeColumn == -1) {

        if (mouseX > (int) geneheader.get(geneheader.size() - 1)[1]
                + (int) geneheader.get(geneheader.size() - 1)[2] - 5
                && mouseX < (int) geneheader.get(geneheader.size() - 1)[1]
                        + (int) geneheader.get(geneheader.size() - 1)[2] + 15) {
            resizeColumn = geneheader.size();

        }
    }
    buf.setColor(Color.darkGray);
    buf.fillRect((int) geneheader.get(geneheader.size() - 1)[1] + (int) geneheader.get(geneheader.size() - 1)[2]
            + 11, y, this.width, rowHeight);
    buf.setColor(Color.black);
    buf.drawLine(
            (int) geneheader.get(geneheader.size() - 1)[1] + (int) geneheader.get(geneheader.size() - 1)[2]
                    + 10,
            y, (int) geneheader.get(geneheader.size() - 1)[1] + (int) geneheader.get(geneheader.size() - 1)[2]
                    + 10,
            y + rowHeight);
}

From source file:base.BasePlayer.ClusterTable.java

void drawGeneheader(int y) {
    for (int i = 0; i < geneheader.size(); i++) {
        buf.setColor(Color.darkGray);
        buf.fillRect((int) ((int) geneheader.get(i)[1]) + 10, y, (int) geneheader.get(i)[2], rowHeight);

        if (mouseY - tablescroll.getVerticalScrollBar().getValue() <= y + rowHeight
                && mouseY - tablescroll.getVerticalScrollBar().getValue() >= y) {

            if (mouseX >= (int) geneheader.get(i)[1] + 10
                    && mouseX <= (int) geneheader.get(i)[1] + (int) geneheader.get(i)[2] + 10) {

                geneHeaderHover = i;//w ww . ja v  a2s .c o  m
                buf.setColor(Color.yellow);
            } else if (mouseX >= (int) geneheader.get(geneheader.size() - 1)[1]
                    + (int) geneheader.get(geneheader.size() - 1)[2] + 10) {
                geneHeaderHover = geneheader.size();
                buf.setColor(Color.white);
            } else {
                buf.setColor(Color.white);
            }

        } else {

            buf.setColor(Color.white);
        }
        if (!mouseDrag && geneHeaderHover > -1 && i > 0 && i < geneheader.size()) {
            if (mouseX > (int) geneheader.get(i)[1] + 5 && mouseX < (int) geneheader.get(i)[1] + 15) {
                if (resizeColumn != i) {
                    resizeColumn = i;
                }
            }
        }
        if (geneheader.get(i)[0] instanceof String) {
            buf.drawString((String) geneheader.get(i)[0], (int) geneheader.get(i)[1] + 14, y + rowHeight - 3);
        } else if (geneheader.get(i)[0] instanceof ControlFile) {
            ControlFile ctrlfile = (ControlFile) geneheader.get(i)[0];
            buf.drawString("AF: " + ctrlfile.getName(), (int) geneheader.get(i)[1] + 14, y + rowHeight - 3);
            ctrlfile = null;
        } else {
            BedTrack track = (BedTrack) geneheader.get(i)[0];
            if (track.file != null) {
                buf.drawString(track.file.getName(), (int) geneheader.get(i)[1] + 14, y + rowHeight - 3);
            } else {
                buf.drawString(track.url.getFile().toString(), (int) geneheader.get(i)[1] + 14,
                        y + rowHeight - 3);
            }
            track = null;
        }
        buf.setColor(Color.black);
        buf.drawLine((int) geneheader.get(i)[1] + 10, y, (int) ((int) geneheader.get(i)[1]) + 10,
                y + rowHeight);

    }

    if (!mouseDrag && geneHeaderHover > -1 && resizeColumn == -1) {
        if (mouseX > (int) geneheader.get(geneheader.size() - 1)[1]
                + (int) geneheader.get(geneheader.size() - 1)[2] - 5
                && mouseX < (int) geneheader.get(geneheader.size() - 1)[1]
                        + (int) geneheader.get(geneheader.size() - 1)[2] + 15) {
            resizeColumn = geneheader.size();
        }
    }
    buf.setColor(Color.darkGray);
    buf.fillRect((int) geneheader.get(geneheader.size() - 1)[1] + (int) geneheader.get(geneheader.size() - 1)[2]
            + 11, y, this.width, rowHeight);
    buf.setColor(Color.black);
    buf.drawLine(
            (int) geneheader.get(geneheader.size() - 1)[1] + (int) geneheader.get(geneheader.size() - 1)[2]
                    + 10,
            y, (int) geneheader.get(geneheader.size() - 1)[1] + (int) geneheader.get(geneheader.size() - 1)[2]
                    + 10,
            y + rowHeight);
}