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:jamel.gui.charts.TwoSeriesScatterChart.java

/**
 * Creates a new scatter chart./*w  w  w .j  a  v  a  2  s  .c  o m*/
 * @param title  the title.
 * @param xTimeSeries  the x time series.
 * @param xLabel  the label of the x axis.
 * @param yTimeSeries  the y time series.
 * @param yLabel  the label of the y axis.
 */
public TwoSeriesScatterChart(String title, TimeSeries xTimeSeries, String xLabel, TimeSeries yTimeSeries,
        String yLabel) {
    super(title, null, xLabel, yLabel);
    this.xTimeSeries = xTimeSeries;
    this.yTimeSeries = yTimeSeries;
    final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesPaint(0, Color.GRAY);
    renderer.setSeriesFillPaint(0, JamelColor.LIGHT_TRANSPARENT_RED);
    renderer.setUseFillPaint(true);
    ((XYPlot) getPlot()).setRenderer(renderer);
}

From source file:web.diva.server.model.SparkLineGenerator.java

public SparkLineGenerator(PlotOrientation plotOrientation, double minValue, double maxValue,
        Color negativeValuesColor, Color positiveValuesColor) {

    this(plotOrientation, minValue, maxValue, negativeValuesColor, positiveValuesColor, Color.GRAY, 1);

}

From source file:TrackerPanel.java

public TrackerPanel() {
    setBackground(Color.GRAY);

    df = new DecimalFormat("0.#"); // 1 dp
    msgFont = new Font("SansSerif", Font.BOLD, 13);

    configOpenNI();/*from   w  ww .  j  a va  2 s.  c om*/

    histogram = new float[MAX_DEPTH_SIZE];

    imWidth = depthMD.getFullXRes();
    imHeight = depthMD.getFullYRes();
    setSize(imWidth * 2, imHeight);
    System.out.println("Image dimensions (" + imWidth + ", " + imHeight + ")");
    // create empty image bytes array of correct size and type
    imgbytes = new byte[imWidth * imHeight * 3];
    hideBGPixel = new Color(0, 0, 255, 0).getRGB();

    // create d.s for holding camera pixels and image
    cameraPixels = new int[imWidth * imHeight];
    cameraImage = new BufferedImage(imWidth, imHeight, BufferedImage.TYPE_INT_ARGB);
    // the image must have an alpha channel for the transparent blue pixels

    new Thread(this).start(); // start updating the panel
}

From source file:com.yanbang.portal.controller.PortalController.java

/**
 * ???/*from w  w  w.  ja  v a  2  s  . c om*/
 * 
 * @param request
 * @param response
 * @return
 * @throws Exception
 */
@RequestMapping(params = "action=handleRnd")
public void handleRnd(HttpServletRequest request, HttpServletResponse response) throws Exception {
    response.setHeader("Cache-Control", "no-store");
    response.setHeader("Pragma", "no-cache");
    response.setDateHeader("Expires", 0L);
    response.setContentType("image/jpeg");
    BufferedImage image = new BufferedImage(65, 25, BufferedImage.TYPE_INT_RGB);
    Graphics g = image.getGraphics();
    g.setColor(Color.GRAY);
    g.fillRect(0, 0, 65, 25);
    g.setColor(Color.yellow);
    Font font = new Font("", Font.BOLD, 20);
    g.setFont(font);
    Random r = new Random();
    String rnd = "";
    int ir = r.nextInt(10);
    rnd = rnd + "" + ir;
    g.drawString("" + ir, 5, 18);
    g.setColor(Color.red);
    ir = r.nextInt(10);
    rnd = rnd + "" + ir;
    g.drawString("" + ir, 20, 18);
    g.setColor(Color.blue);
    ir = r.nextInt(10);
    rnd = rnd + "" + ir;
    g.drawString("" + ir, 35, 18);
    g.setColor(Color.green);
    ir = r.nextInt(10);
    rnd = rnd + "" + ir;
    g.drawString("" + ir, 50, 18);
    request.getSession().setAttribute("RND", rnd);
    ServletOutputStream out = response.getOutputStream();
    out.write(ImageUtil.imageToBytes(image, "gif"));
    out.flush();
    out.close();
}

From source file:it.alus.GPSreceiver.instruments.Altimeter.java

public Altimeter(float groundAltitudeFt) {
    super(null);/*from w  w w  .j a v a 2s. com*/
    altitude = 0;
    if (groundAltitudeFt < 0)
        groundAltitude = 0;
    else
        groundAltitude = groundAltitudeFt;
    hoursDataset = new DefaultValueDataset(0.0);
    minutesDataset = new DefaultValueDataset(0.0);
    DialPlot plot = new DialPlot();
    plot.setView(0.0, 0.0, 1.0, 1.0);
    Image background = Toolkit.getDefaultToolkit().getImage(getClass().getResource("altimeter.png"));
    plot.setDataset(0, hoursDataset);
    plot.setDataset(1, minutesDataset);
    StandardDialFrame dialFrame = new StandardDialFrame();
    dialFrame.setBackgroundPaint(Color.lightGray);
    dialFrame.setForegroundPaint(Color.gray);
    DialTextAnnotation annotation = new DialTextAnnotation("Feet");
    annotation.setFont(new Font("Arial", 1, 14));
    annotation.setRadius(0.4D);
    annotation.setPaint(Color.lightGray);
    plot.addLayer(annotation);
    DialValueIndicator valueindicator = new DialValueIndicator(0);
    NumberFormat formatter = new DecimalFormat("#");
    plot.addLayer(valueindicator);
    plot.setDialFrame(dialFrame);
    StandardDialScale scale = new StandardDialScale(0, 10, 90, -360, 1, 10);
    scale.setMajorTickPaint(Color.white);
    scale.setMinorTickPaint(Color.lightGray);
    scale.setFirstTickLabelVisible(false);
    scale.setTickRadius(0.88);
    scale.setTickLabelOffset(0.15);
    scale.setTickLabelFormatter(formatter);
    scale.setTickLabelFont(new Font("Arial", Font.BOLD, 24));
    scale.setTickLabelPaint(Color.white);
    plot.addScale(3, scale);
    plot.setBackground(new DialBackground(Color.black));
    StandardDialScale hourScale = new StandardDialScale(0, 10000, 90, -360, 1000, 10);
    hourScale.setVisible(false);
    hourScale.setTickRadius(0.88);
    hourScale.setTickLabelOffset(0.15);
    plot.addScale(0, hourScale);
    StandardDialScale minScale = new StandardDialScale(0, 1000, 90, -360, 0, 0);
    minScale.setVisible(false);
    minScale.setMajorTickIncrement(5.0);
    minScale.setTickRadius(0.68);
    plot.addScale(1, minScale);
    Pointer hourNeedle = new Pointer(0);
    hourNeedle.setRadius(0.55);
    hourNeedle.setFillPaint(Color.lightGray);
    plot.addLayer(hourNeedle);
    plot.mapDatasetToScale(1, 1);
    Pointer minNeedle = new Pointer(1);
    minNeedle.setFillPaint(Color.white);
    plot.addLayer(minNeedle);
    DialCap cap = new DialCap();
    cap.setRadius(0.10);
    cap.setFillPaint(Color.lightGray);
    plot.setCap(cap);
    jChart = new JFreeChart(plot);
    jChart.setBackgroundImage(background);
    super.setChart(jChart);
    super.setPreferredSize(new Dimension(400, 400));
}

From source file:it.eng.spagobi.engines.kpi.bo.charttypes.dialcharts.Meter.java

/**
 * Creates the MeterChart ./*  ww w .j  a  v  a 2 s .  c o m*/
 * 
 * @return A MeterChart .
 */
public JFreeChart createChart() {
    logger.debug("IN");
    if (dataset == null) {
        logger.debug("The dataset to be represented is null");
        return null;
    }
    MeterPlot plot = new MeterPlot((ValueDataset) dataset);
    logger.debug("Created new plot");
    plot.setRange(new Range(lower, upper));
    logger.debug("Setted plot range");

    for (Iterator iterator = intervals.iterator(); iterator.hasNext();) {
        KpiInterval interval = (KpiInterval) iterator.next();
        plot.addInterval(new MeterInterval(interval.getLabel(), new Range(interval.getMin(), interval.getMax()),
                Color.lightGray, new BasicStroke(2.0f), interval.getColor()));
        logger.debug("Added new interval to the plot");
    }

    plot.setNeedlePaint(Color.darkGray);
    plot.setDialBackgroundPaint(Color.white);
    plot.setDialOutlinePaint(Color.gray);
    plot.setDialShape(DialShape.CHORD);
    plot.setMeterAngle(260);
    plot.setTickLabelsVisible(true);
    Font f = new Font("Arial", Font.PLAIN, 11);
    plot.setTickLabelFont(f);
    plot.setTickLabelPaint(Color.darkGray);
    plot.setTickSize(5.0);
    plot.setTickPaint(Color.lightGray);
    plot.setValuePaint(Color.black);
    plot.setValueFont(new Font("Arial", Font.PLAIN, 14));
    logger.debug("Setted all properties of the plot");

    JFreeChart chart = new JFreeChart(name, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    logger.debug("Created the chart");
    chart.setBackgroundPaint(color);
    logger.debug("Setted background color of the chart");

    TextTitle title = setStyleTitle(name, styleTitle);
    chart.setTitle(title);
    logger.debug("Setted the title of the chart");
    if (subName != null && !subName.equals("")) {
        TextTitle subTitle = setStyleTitle(subName, styleSubTitle);
        chart.addSubtitle(subTitle);
        logger.debug("Setted the subtitle of the chart");
    }
    logger.debug("OUT");
    return chart;
}

From source file:org.matsim.analysis.LegHistogramChart.java

static JFreeChart getGraphic(final LegHistogram.DataFrame dataFrame, final String mode, int iteration) {
    final XYSeriesCollection xyData = new XYSeriesCollection();
    final XYSeries departuresSerie = new XYSeries("departures", false, true);
    final XYSeries arrivalsSerie = new XYSeries("arrivals", false, true);
    final XYSeries onRouteSerie = new XYSeries("en route", false, true);
    int onRoute = 0;
    for (int i = 0; i < dataFrame.countsDep.length; i++) {
        onRoute = onRoute + dataFrame.countsDep[i] - dataFrame.countsArr[i] - dataFrame.countsStuck[i];
        double hour = i * dataFrame.binSize / 60.0 / 60.0;
        departuresSerie.add(hour, dataFrame.countsDep[i]);
        arrivalsSerie.add(hour, dataFrame.countsArr[i]);
        onRouteSerie.add(hour, onRoute);
    }// w  ww  .j  av a2 s  . c  o  m

    xyData.addSeries(departuresSerie);
    xyData.addSeries(arrivalsSerie);
    xyData.addSeries(onRouteSerie);

    final JFreeChart chart = ChartFactory.createXYStepChart("Leg Histogram, " + mode + ", it." + iteration,
            "time", "# persons", xyData, PlotOrientation.VERTICAL, true, // legend
            false, // tooltips
            false // urls
    );

    XYPlot plot = chart.getXYPlot();

    final CategoryAxis axis1 = new CategoryAxis("hour");
    axis1.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 7));
    plot.setDomainAxis(new NumberAxis("time"));

    plot.getRenderer().setSeriesStroke(0, new BasicStroke(2.0f));
    plot.getRenderer().setSeriesStroke(1, new BasicStroke(2.0f));
    plot.getRenderer().setSeriesStroke(2, new BasicStroke(2.0f));
    plot.setBackgroundPaint(Color.white);
    plot.setRangeGridlinePaint(Color.gray);
    plot.setDomainGridlinePaint(Color.gray);

    return chart;
}

From source file:org.gvsig.gui.beans.graphic.GraphicChartPanel.java

/**
 * @return// ww  w.j av a 2s  .c  o m
 */
public ChartPanel getChart() {
    if (jPanelChart == null) {
        jPanelChart = new ChartPanel(chart);
        jPanelChart.setBorder(BorderFactory.createLineBorder(Color.gray, 1));
    }
    return jPanelChart;
}

From source file:FTPApp.java

public FTPApp() {
    super("FTP Client");

    JPanel p = new JPanel();
    p.setBorder(new EmptyBorder(5, 5, 5, 5));

    p.add(new JLabel("User name:"));
    p.add(userNameTextField);//from w  w w .  j av a  2 s  .  c om
    p.add(new JLabel("Password:"));
    p.add(passwordTextField);
    p.add(new JLabel("URL:"));
    p.add(urlTextField);
    p.add(new JLabel("File:"));
    p.add(fileTextField);

    monitorTextArea.setEditable(false);
    JScrollPane ps = new JScrollPane(monitorTextArea);
    p.add(ps);

    m_progress.setStringPainted(true);
    m_progress.setBorder(new BevelBorder(BevelBorder.LOWERED, Color.white, Color.gray));
    m_progress.setMinimum(0);
    JPanel p1 = new JPanel(new BorderLayout());
    p1.add(m_progress, BorderLayout.CENTER);
    p.add(p1);

    ActionListener lst = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (connect()) {
                Thread uploader = new Thread() {
                    public void run() {
                        putFile();
                        disconnect();
                    }
                };
                uploader.start();
            }
        }
    };
    putButton.addActionListener(lst);
    putButton.setMnemonic('p');
    p.add(putButton);

    getButton = new JButton("Get");
    lst = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (connect()) {
                Thread downloader = new Thread() {
                    public void run() {
                        getFile();
                        disconnect();
                    }
                };
                downloader.start();
            }
        }
    };
    getButton.addActionListener(lst);
    getButton.setMnemonic('g');
    p.add(getButton);

    lst = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (fileChooser.showSaveDialog(FTPApp.this) != JFileChooser.APPROVE_OPTION)
                return;
            File f = fileChooser.getSelectedFile();
            fileTextField.setText(f.getPath());
        }
    };
    fileButton.addActionListener(lst);
    fileButton.setMnemonic('f');
    p.add(fileButton);

    lst = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (ftpClient != null)
                disconnect();
            else
                System.exit(0);
        }
    };
    closeButton.addActionListener(lst);
    closeButton.setDefaultCapable(true);
    closeButton.setMnemonic('g');
    p.add(closeButton);

    getContentPane().add(p, BorderLayout.CENTER);

    fileChooser.setCurrentDirectory(new File("."));
    fileChooser.setApproveButtonToolTipText("Select file for upload/download");

    WindowListener wndCloser = new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            disconnect();
            System.exit(0);
        }
    };
    addWindowListener(wndCloser);

    setSize(720, 240);
    setVisible(true);
}

From source file:ShowDocApplet.java

/** Initialize the Applet */
public void init() {
    setBackground(Color.gray);
    try {//w w w. java 2s.  co  m
        targetURL = new URL(targetString);
    } catch (MalformedURLException mfu) {
        throw new IllegalArgumentException("ShowDocApplet got bad URL " + targetString);
    }
    Button b = new Button("View Secret");
    add(b);
    b.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            getAppletContext().showDocument(targetURL);
        }
    });
}