Example usage for java.awt Color gray

List of usage examples for java.awt Color gray

Introduction

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

Prototype

Color gray

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

Click Source Link

Document

The color gray.

Usage

From source file:com.bdb.weather.display.current.Hygrometer.java

private ChartViewer createChartElements() {
    humidityPlot.addLayer(/*  ww  w. j  ava  2  s .co  m*/
            new DialBackground(new GradientPaint(0.0f, 0.0f, Color.LIGHT_GRAY, 100.0f, 0.0f, Color.blue)));
    StandardDialScale scale = new StandardDialScale(Humidity.MIN_HUMIDITY.get(), Humidity.MAX_HUMIDITY.get(),
            240.0, -300.0, 10.0, 9);
    scale.setTickLabelFont(scale.getTickLabelFont().deriveFont(14.0F).deriveFont(Font.PLAIN));
    scale.setTickRadius(.9);
    scale.setTickLabelFormatter(new DecimalFormat("#"));
    scale.setTickLabelOffset(.2);
    scale.setTickLabelPaint(Color.BLACK);
    humidityPlot.addScale(0, scale);
    humidityPlot.setDialFrame(new StandardDialFrame());

    DialValueIndicator valueInd = new DialValueIndicator(0);
    valueInd.setNumberFormat(new DecimalFormat("# '%rH'"));
    Color c = new Color(255, 255, 255, 0);
    valueInd.setBackgroundPaint(c);
    valueInd.setOutlinePaint(c);
    valueInd.setPaint(Color.cyan);
    humidityPlot.addLayer(valueInd);

    double angle = valueInd.getAngle();
    double radius = valueInd.getRadius();

    trendAnnotation.setPaint(Color.cyan);
    trendAnnotation.setAngle(angle);
    trendAnnotation.setRadius(radius + .1);
    humidityPlot.addLayer(trendAnnotation);

    DialPointer.Pointer pointer = new DialPointer.Pointer(0);
    humidityPlot.addPointer(pointer);

    DialCap cap = new DialCap();
    cap.setRadius(cap.getRadius() * 1.5);
    humidityPlot.setCap(cap);

    range = new StandardDialRange(Humidity.MIN_HUMIDITY.get(), Humidity.MAX_HUMIDITY.get(), Color.BLACK);
    range.setInnerRadius(.40);
    range.setOuterRadius(.45);
    range.setScaleIndex(0);
    humidityPlot.addLayer(range);

    JFreeChart chart = new JFreeChart(humidityPlot);
    chart.setBackgroundPaint(Color.GRAY);

    ChartViewer chartViewer = new ChartViewer(chart);
    //chartViewer.setMinHeight(100);
    //chartViewer.setMinWidth(100);
    //chartViewer.setMaxHeight(400);
    //chartViewer.setMaxWidth(400);
    //chartViewer.setBackground(Color.GRAY);
    return chartViewer;
}

From source file:net.nosleep.superanalyzer.util.Misc.java

public static void formatChart(Plot plot) {
    plot.setBackgroundPaint(Color.white);
    plot.setOutlineVisible(false);/* w w  w . j ava  2s.co  m*/
    plot.setNoDataMessage(Misc.getString("NO_DATA_TO_DISPLAY"));

    if ((plot instanceof XYPlot)) {
        XYPlot xyPlot = (XYPlot) plot;
        xyPlot.setDomainGridlinePaint(Color.gray);
        xyPlot.setRangeGridlinePaint(Color.gray);
    }
}

From source file:org.gvsig.remotesensing.scatterplot.gui.ChartScaterPlotPanel.java

/**
 *    @return grafico actual//from  w  w w. j  a  va 2  s.  c  o  m
 * */
public ScatterPlotDiagram getChart() {
    if (jPanelChart == null) {
        jPanelChart = new ScatterPlotDiagram(chart, (FLyrRasterSE) fLayer, new int[] { bandaX, bandaY });
        chart = null;
        jPanelChart.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray, 1));
    }
    return jPanelChart;
}

From source file:com.cburch.draw.tools.LineTool.java

@Override
public void draw(Canvas canvas, Graphics g) {
    if (active) {
        Location start = mouseStart;
        Location end = mouseEnd;// w  w w  . j a v  a2  s  .c o  m
        g.setColor(Color.GRAY);
        g.drawLine(start.getX(), start.getY(), end.getX(), end.getY());
    }
}

From source file:it.eng.spagobi.engines.chart.bo.charttypes.targetcharts.SparkLine.java

@Override
public void configureChart(SourceBean content) {
    logger.debug("IN");
    super.configureChart(content);
    if (confParameters.get(AVG_COLOR) != null
            && !(((String) confParameters.get(AVG_COLOR)).equalsIgnoreCase(""))) {
        String avg_color = (String) confParameters.get(AVG_COLOR);
        Color color = Color.GRAY;
        try {//from   ww w. ja v a2 s . c om
            color = Color.decode(avg_color);
            if (color != null) {
                colorAverage = color;
            }
        } catch (NumberFormatException e) {
            logger.error("Error in average line color, put default GREY", e);
        }
    }
    logger.debug("OUT");
}

From source file:umontreal.ssj.charts.SSJCategorySeriesCollection.java

/**
 * Converts a java Color object into a friendly and readable LaTeX/xcolor string.
 *
 * @param   color    in color./*from  w ww.  j  a  v a2  s  .  c om*/
 * @return           friendly color with string format as possible, null otherwise.
 */
protected static String detectXColorClassic(Color color) {
    String retour = null;

    int red = color.getRed();
    int green = color.getGreen();
    int blue = color.getBlue();

    // On utilise pas la method Color.equals(Color ) car on ne veut pas tester le parametre de transparence : Alpha
    if (red == Color.GREEN.getRed() && blue == Color.GREEN.getBlue() && green == Color.GREEN.getGreen())
        return "green";
    else if (red == Color.RED.getRed() && blue == Color.RED.getBlue() && green == Color.RED.getGreen())
        return "red";
    else if (red == Color.WHITE.getRed() && blue == Color.WHITE.getBlue() && green == Color.WHITE.getGreen())
        return "white";
    else if (red == Color.GRAY.getRed() && blue == Color.GRAY.getBlue() && green == Color.GRAY.getGreen())
        return "gray";
    else if (red == Color.BLACK.getRed() && blue == Color.BLACK.getBlue() && green == Color.BLACK.getGreen())
        return "black";
    else if (red == Color.YELLOW.getRed() && blue == Color.YELLOW.getBlue() && green == Color.YELLOW.getGreen())
        return "yellow";
    else if (red == Color.MAGENTA.getRed() && blue == Color.MAGENTA.getBlue()
            && green == Color.MAGENTA.getGreen())
        return "magenta";
    else if (red == Color.CYAN.getRed() && blue == Color.CYAN.getBlue() && green == Color.CYAN.getGreen())
        return "cyan";
    else if (red == Color.BLUE.getRed() && blue == Color.BLUE.getBlue() && green == Color.BLUE.getGreen())
        return "blue";
    else if (red == Color.DARK_GRAY.getRed() && blue == Color.DARK_GRAY.getBlue()
            && green == Color.DARK_GRAY.getGreen())
        return "darkgray";
    else if (red == Color.LIGHT_GRAY.getRed() && blue == Color.LIGHT_GRAY.getBlue()
            && green == Color.LIGHT_GRAY.getGreen())
        return "lightgray";
    else if (red == Color.ORANGE.getRed() && blue == Color.ORANGE.getBlue() && green == Color.ORANGE.getGreen())
        return "orange";
    else if (red == Color.PINK.getRed() && blue == Color.PINK.getBlue() && green == Color.PINK.getGreen())
        return "pink";

    if (red == 192 && blue == 128 && green == 64)
        return "brown";
    else if (red == 128 && blue == 128 && green == 0)
        return "olive";
    else if (red == 128 && blue == 0 && green == 128)
        return "violet";
    else if (red == 192 && blue == 0 && green == 64)
        return "purple";
    else
        return null;
}

From source file:com.floreantpos.ui.dialog.DiscountSelectionDialog.java

private void createCouponSearchPanel() {
    itemSearchPanel = new JPanel(new BorderLayout(5, 5));
    PosButton btnSearch = new PosButton("...");
    btnSearch.setPreferredSize(new Dimension(60, 40));

    JLabel lblCoupon = new JLabel("Enter Coupon Number");

    txtSearchItem = new JTextField();
    txtSearchItem.addFocusListener(new FocusListener() {
        @Override//from   www . j  a  va  2  s . c om
        public void focusLost(FocusEvent e) {
            txtSearchItem.setText("Scan barcode");
            txtSearchItem.setForeground(Color.gray);
        }

        @Override
        public void focusGained(FocusEvent e) {
            txtSearchItem.setForeground(Color.black);
            txtSearchItem.setText("");
        }
    });

    txtSearchItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (txtSearchItem.getText().equals("")) {
                POSMessageDialog.showMessage("Please enter coupon number or barcode ");
                return;
            }
            if (!addCouponByBarcode(txtSearchItem.getText())) {
                addCouponById(txtSearchItem.getText());
            }
            txtSearchItem.setText("");
        }
    });

    btnSearch.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            ItemSearchDialog dialog = new ItemSearchDialog(Application.getPosWindow());
            dialog.setTitle("Search Coupon");
            dialog.pack();
            dialog.open();
            if (dialog.isCanceled()) {
                return;
            }

            txtSearchItem.requestFocus();

            if (!addCouponByBarcode(dialog.getValue())) {
                if (!addCouponById(dialog.getValue())) {
                    POSMessageDialog.showError(Application.getPosWindow(), "Coupon not found");
                }
            }
        }
    });
    itemSearchPanel.add(lblCoupon, BorderLayout.WEST);
    itemSearchPanel.add(txtSearchItem);
    itemSearchPanel.add(btnSearch, BorderLayout.EAST);
}

From source file:es.unex.meigas.extFillData.FittingDataPanel.java

public ChartPanel getChart() {

    if (jPanelChart == null) {
        jPanelChart = new ChartPanel(chart);
        jPanelChart.setSize(new java.awt.Dimension(width - WIDTH_MARGIN, height - HEIGHT_MARGIN));
        jPanelChart.setPreferredSize(new java.awt.Dimension(width - WIDTH_MARGIN, height - HEIGHT_MARGIN));
        jPanelChart.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray, 1));
    }/*from w  w w  . j  av  a  2 s.c om*/
    return jPanelChart;
}

From source file:com.liferay.server.admin.web.internal.portlet.action.ViewChartMVCResourceCommand.java

protected MeterPlot getMeterPlot(ThemeDisplay themeDisplay, ValueDataset valueDataset) {

    MeterPlot meterPlot = new MeterPlot(valueDataset);

    meterPlot.addInterval(new MeterInterval(themeDisplay.translate("normal"), new Range(0.0D, 75D),
            Color.lightGray, new BasicStroke(2.0F), new Color(0, 255, 0, 64)));

    meterPlot.addInterval(new MeterInterval(themeDisplay.translate("warning"), new Range(75D, 90D),
            Color.lightGray, new BasicStroke(2.0F), new Color(255, 255, 0, 64)));

    meterPlot.addInterval(new MeterInterval(themeDisplay.translate("critical"), new Range(90D, 100D),
            Color.lightGray, new BasicStroke(2.0F), new Color(255, 0, 0, 128)));

    meterPlot.setDialBackgroundPaint(Color.white);
    meterPlot.setDialShape(DialShape.PIE);
    meterPlot.setDialOutlinePaint(Color.gray);
    meterPlot.setTickLabelFont(new Font(null, Font.PLAIN, 10));
    meterPlot.setTickLabelPaint(Color.darkGray);
    meterPlot.setTickLabelsVisible(true);
    meterPlot.setTickPaint(Color.lightGray);
    meterPlot.setTickSize(5D);/* w  ww .j a  v  a2  s  . c om*/
    meterPlot.setMeterAngle(180);
    meterPlot.setNeedlePaint(Color.darkGray);
    meterPlot.setRange(new Range(0.0D, 100D));
    meterPlot.setValueFont(new Font(null, Font.PLAIN, 10));
    meterPlot.setValuePaint(Color.black);
    meterPlot.setUnits("%");

    return meterPlot;
}

From source file:com.syncleus.dann.graph.jung.BrainPanel.java

@Override
protected void initVis(VisualizationViewer<N, S> vis) {
    vis.getRenderContext().setVertexLabelTransformer(new NeuronLabeller());
    vis.getRenderContext().setEdgeLabelTransformer(new SynapseLabeller());
    vis.getRenderContext().setVertexFillPaintTransformer(new Transformer<N, Paint>() {

        public Paint transform(N n) {
            if (n instanceof InputNeuron) {
                return Color.MAGENTA;
            } else if (n instanceof OutputNeuron) {
                return Color.GREEN;
            } else {
                return Color.GRAY;
            }/*from  w w  w  .j  a  va 2  s. c  o m*/
        }
    });
    vis.getRenderContext().setVertexShapeTransformer(new Transformer<N, Shape>() {

        public Shape transform(N n) {
            float s = 0.5f;
            if (n instanceof OutputNeuron) {
                OutputNeuron aan = (OutputNeuron) n;
                s = (float) Math.abs(aan.getOutput());
            } else if (n instanceof InputNeuron) {
                InputNeuron aan = (InputNeuron) n;
                s = (float) Math.abs(aan.getInput());
            }
            int w = (int) (s * 44.0);
            int h = (int) (s * 44.0);
            int x = -w / 2;
            int y = -h / 2;
            return new Rectangle2D.Float(x, y, w, h);
        }
    });
    vis.getRenderContext().setEdgeStrokeTransformer(new Transformer<S, Stroke>() {

        public Stroke transform(S i) {
            return new BasicStroke((int) ((Math.abs(i.getWeight())) * 8.0));
        }
    });
    vis.getRenderContext().setEdgeDrawPaintTransformer(new Transformer<S, Paint>() {

        public Paint transform(S syn) {
            float b = (float) Math.abs(syn.getWeight());
            float s = 0.8f;
            float h = syn.getWeight() < 0 ? 0.6f : 0.9f;
            return Color.getHSBColor(h, s, b);
        }
    });

}