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:edu.ucla.stat.SOCR.chart.demo.DotChart.java

public void resetExample() {
    // System.out.println("resetExample get called");
    XYDataset dataset = createDataset1(true);

    //   JFreeChart chart = createChart1(dataset);   
    //   chartPanel1 = new ChartPanel(chart, false); 
    XYDataset dataset1 = createDataset1(true);
    JFreeChart chart1 = createChart1(dataset1);

    BoxAndWhiskerCategoryDataset dataset2 = createDataset2(true);
    JFreeChart chart2 = createChart2(dataset2);
    chartPanel1 = new ChartPanel(chart1, false);
    chartPanel1.setPreferredSize(new Dimension(CHART_SIZE_X, CHART_SIZE_Y * 2 / 3));

    chartPanel2 = new ChartPanel(chart2, false);
    chartPanel2.setPreferredSize(new Dimension(CHART_SIZE_X, CHART_SIZE_Y / 3));

    this.setChart();

    hasExample = true;// w  ww.j  a v  a2 s  . c  o  m

    //  System.out.println("row_count="+row_count);
    //  System.out.println("raw+x="+raw_x[0]);
    convertor.Y2Table(raw_x, row_count);
    //convertor.dataset2Table(dataset);            
    JTable tempDataTable = convertor.getTable();

    resetTableRows(tempDataTable.getRowCount() + 1);
    resetTableColumns(tempDataTable.getColumnCount());

    for (int i = 0; i < tempDataTable.getColumnCount(); i++) {
        columnModel.getColumn(i).setHeaderValue(tempDataTable.getColumnName(i));
        //  System.out.println("updateExample tempDataTable["+i+"] = " +tempDataTable.getColumnName(i));
    }

    columnModel = dataTable.getColumnModel();
    dataTable.setTableHeader(new EditableHeader(columnModel));

    for (int i = 0; i < tempDataTable.getRowCount(); i++)
        for (int j = 0; j < tempDataTable.getColumnCount(); j++) {
            dataTable.setValueAt(tempDataTable.getValueAt(i, j), i, j);
        }

    dataPanel.removeAll();
    dataPanel.add(new JScrollPane(dataTable));
    dataTable.setGridColor(Color.gray);
    dataTable.setShowGrid(true);
    dataTable.doLayout();
    // this is a fix for the BAD SGI Java VM - not up to date as of dec. 22, 2003
    try {
        dataTable.setDragEnabled(true);
    } catch (Exception e) {
    }

    dataPanel.validate();

    // do the mapping
    setMapping();
    updateStatus(url);
}

From source file:adams.flow.sink.JFreeChartFileWriter.java

/**
 * Executes the flow item./*from   ww w .j a  v a  2s  . co  m*/
 *
 * @return      null if everything is fine, otherwise error message
 */
@Override
protected String doExecute() {
    String result;
    SpreadSheet sheet;
    Dataset dataset;
    JFreeChart jfreechart;
    BufferedImage image;
    BufferedImageContainer cont;
    Shape shape;
    XYPlot plot;

    result = null;

    try {
        sheet = (SpreadSheet) m_InputToken.getPayload();
        dataset = m_Dataset.generate(sheet);
        jfreechart = m_Chart.generate(dataset);
        shape = m_Shape.generate();
        jfreechart.getPlot().setBackgroundPaint(Color.WHITE);
        if (jfreechart.getPlot() instanceof XYPlot) {
            plot = (XYPlot) jfreechart.getPlot();
            plot.setDomainGridlinesVisible(true);
            plot.setDomainGridlinePaint(Color.GRAY);
            plot.setRangeGridlinesVisible(true);
            plot.setRangeGridlinePaint(Color.GRAY);
            plot.getRenderer().setSeriesPaint(0, m_PlotColor);
            if (plot.getSeriesCount() > 1)
                plot.getRenderer().setSeriesPaint(1, m_DiagonalColor);
            if (shape != null)
                plot.getRenderer().setSeriesShape(0, shape);
        }
        image = jfreechart.createBufferedImage(m_Width, m_Height);
        cont = new BufferedImageContainer();
        cont.setImage(image);
        m_Writer.write(m_OutputFile, cont);
    } catch (Exception e) {
        result = handleException("Failed to generate plot!", e);
    }

    return result;
}

From source file:edu.ucla.stat.SOCR.chart.SuperPieChart.java

/**
* reset dataTable to default (demo data), and refesh chart
*//*from  w w  w  .jav  a 2  s  .co  m*/
public void resetExample() {

    isDemo = true;
    dataset = createDataset(true);

    JFreeChart chart = createChart(dataset);
    chartPanel = new ChartPanel(chart, false);
    setChart();

    hasExample = true;
    if (!ThreeDPie)
        convertor.dataset2Table(dataset, pulloutFlag);
    else
        convertor.dataset2Table(dataset);

    JTable tempDataTable = convertor.getTable();
    // resetTable();
    resetTableRows(tempDataTable.getRowCount() + 1);
    resetTableColumns(tempDataTable.getColumnCount() + 1);

    for (int i = 0; i < tempDataTable.getColumnCount(); i++) {
        columnModel.getColumn(i).setHeaderValue(tempDataTable.getColumnName(i));
        //  System.out.println("updateExample tempDataTable["+i+"] = " +tempDataTable.getColumnName(i));
    }

    columnModel = dataTable.getColumnModel();
    dataTable.setTableHeader(new EditableHeader(columnModel));

    for (int i = 0; i < tempDataTable.getRowCount(); i++)
        for (int j = 0; j < tempDataTable.getColumnCount(); j++) {
            dataTable.setValueAt(tempDataTable.getValueAt(i, j), i, j);
            //System.out.println("setting dataTable :"+tempDataTable.getValueAt(i,j));
        }
    dataPanel.removeAll();
    dataPanel.add(new JScrollPane(dataTable));
    dataTable.setGridColor(Color.gray);
    dataTable.setShowGrid(true);
    dataTable.doLayout();

    // this is a fix for the BAD SGI Java VM - not up to date as of dec. 22, 2003
    try {
        dataTable.setDragEnabled(true);
    } catch (Exception e) {
    }

    dataPanel.validate();

    // do the mapping
    setMapping();
    updateStatus(url);
}

From source file:com.juanhg.car.CarApplet.java

private void updatePiston() {
    Color liquidColor;/* ww w.  ja va2  s.  com*/
    if (model.getCurrentPhase() <= 2) {
        liquidColor = new Color(100, 180, 255, 150);
    } else {
        liquidColor = new Color(255, 100, 100, 150);
    }
    double currentH = normalize(model.getH(), model.getHMin(), model.getHMax(), 0.5, 6.5);
    currentH = 7 - currentH;

    chartPiston.deleteAnnotation(liquidAnnotation);
    liquidAnnotation = chartPiston.drawBox(2.8, currentH - 0.2, 5, 7.5, null, null, liquidColor);
    chartPiston.deleteAnnotation(pistonBodyAnnotation);
    pistonBodyAnnotation = chartPiston.setImageAtPoint(pistonImage, (supPistonXLimit - infPistonXLimit) / 2.0,
            3);

    chartPiston.deleteAnnotation(lineAnnotation);
    lineAnnotation = chartPiston.drawBox(((supPistonXLimit - infPistonXLimit) / 2.0) - 0.1, -4,
            ((supPistonXLimit - infPistonXLimit) / 2.0) + 0.1, currentH, new BasicStroke(2f), Color.BLACK,
            Color.GRAY);
    chartPiston.deleteAnnotation(headAnnotation);
    headAnnotation = chartPiston.setImageAtPoint(headImage, ((supPistonXLimit - infPistonXLimit) / 2.0) - 0.025,
            currentH);
}

From source file:eu.ggnet.dwoss.misc.op.listings.SalesListingProducerOperation.java

/**
 * Generates XLS files for units in a specific sales channel.
 * The lists are seperated by brand./*from w w  w.  jav  a 2s.c o  m*/
 * <p>
 * @param channel the saleschannel
 * @return XLS files for units in a specific sales channel.
 */
private Map<TradeName, Collection<FileJacket>> generateXlsListings(SalesChannel channel) {
    SubMonitor m = monitorFactory.newSubMonitor("Listen fr " + channel.getName() + " erstellen", 100);
    m.start();
    List<StockUnit> stockUnits = new StockUnitEao(stockEm).findByNoLogicTransactionAndPresentStock();
    List<UniqueUnit> uniqueUnits = new UniqueUnitEao(uuEm).findByIds(toUniqueUnitIds(stockUnits));

    Map<TradeName, List<UniqueUnit>> units = uniqueUnits.stream()
            .collect(Collectors.groupingBy(uu -> uu.getProduct().getTradeName()));

    m.worked(2, "prfe und filtere Gerte");
    Map<TradeName, Collection<FileJacket>> files = new HashMap<>();

    for (TradeName k : units.keySet()) {
        List<UniqueUnit> uus = units.get(k);
        Collections.sort(uus, new UniqueUnitComparator());
        List<Object[]> rows = new ArrayList<>();
        for (UniqueUnit get : uus) {
            UniqueUnit uu = get;
            Product p = uu.getProduct();

            // Cases to filter out.
            if (uu.getSalesChannel() != channel)
                continue;
            if (!uu.hasPrice((channel == SalesChannel.CUSTOMER ? PriceType.CUSTOMER : PriceType.RETAILER)))
                continue;

            Object[] row = { uu.getRefurbishId(), p.getPartNo(), p.getGroup().getNote(),
                    p.getTradeName().getName(), p.getName(), p.getDescription(), uu.getWarranty().getName(),
                    uu.getWarrentyValid(), UniqueUnitFormater.toSingleLineAccessories(uu),
                    uu.getCondition().getNote(), UniqueUnitFormater.toSingleLineComment(uu),
                    uu.getPrice(PriceType.RETAILER), uu.getPrice(PriceType.CUSTOMER),
                    (!uu.hasPrice(PriceType.CUSTOMER) ? null
                            : MathUtil.roundedApply(uu.getPrice(PriceType.CUSTOMER), GlobalConfig.TAX, 0)), };
            rows.add(row);
        }
        if (rows.isEmpty())
            continue;

        m.worked(5, "creating File, Gerte: " + rows.size());

        STable unitTable = new STable();
        unitTable.setTableFormat(
                new CFormat(CENTER, TOP, new CBorder(Color.GRAY, CBorder.LineStyle.THIN), true));
        unitTable.setHeadlineFormat(
                new CFormat(CFormat.FontStyle.BOLD, Color.BLACK, Color.LIGHT_GRAY, CENTER, MIDDLE));
        unitTable.setRowHeight(1000);

        unitTable.add(new STableColumn("SopoNr", 12));
        unitTable.add(new STableColumn("ArtikelNr", 15));
        unitTable.add(new STableColumn("Warengruppe", 18));
        unitTable.add(new STableColumn("Hersteller", 15));
        unitTable.add(new STableColumn("Bezeichnung", 30));
        unitTable.add(new STableColumn("Beschreibung", 60, LFT));
        unitTable.add(new STableColumn("Garantie", 18, LFT));
        unitTable.add(new STableColumn("Garantie bis", 18, new CFormat(Representation.SHORT_DATE)));
        unitTable.add(new STableColumn("Zubehr", 30, LFT));
        unitTable.add(new STableColumn("optische Bewertung", 25));
        unitTable.add(new STableColumn("Bemerkung", 50, LFT));
        unitTable.add(new STableColumn("Hndler", 15, EURO));
        unitTable.add(new STableColumn("Endkunde", 15, EURO));
        unitTable.add(new STableColumn("E.inc.Mwst", 15, EURO));
        unitTable.setModel(new STableModelList(rows));

        CCalcDocument cdoc = new TempCalcDocument();
        cdoc.add(new CSheet("Sonderposten", unitTable));
        files.put(k, Arrays.asList(new FileJacket(k.getName() + " Liste", ".xls",
                LucidCalc.createWriter(LucidCalc.Backend.XLS).write(cdoc))));
    }
    m.finish();
    return files;
}

From source file:tools.descartes.bungee.chart.ChartGenerator.java

public static XYPlot createIntensityPlot(final List<ArrivalRateTuple> intensities) {
    final TimeSeriesCollection dataset = new TimeSeriesCollection();
    final TimeSeries series = new TimeSeries("load intensity");
    for (ArrivalRateTuple intensity : intensities) {
        long milliseconds = (referenceDate.getTime() / 1000 + (long) Math.floor(intensity.getTimeStamp()))
                * 1000;/*from ww w  .  j a  v  a2 s .  co m*/
        series.add(new FixedMillisecond(milliseconds), intensity.getArrivalRate());
    }
    dataset.addSeries(series);

    XYStepRenderer renderer = new XYStepRenderer();
    //renderer.setSeriesStroke(0, (new BasicStroke(2.0F)));   
    renderer.setSeriesPaint(0, Color.GRAY);
    final NumberAxis rangeAxis = new NumberAxis("Arrival Rate [1/s]");
    //rangeAxis.setRange(0, 220);
    final XYPlot intensityPlot = new XYPlot(dataset, null, rangeAxis, renderer);
    return intensityPlot;
}

From source file:edu.ucla.stat.SOCR.chart.SuperBoxAndWhiskerChart_Vertical.java

/**
 *  reset dataTable to default (demo data), and refesh chart
 *//*from   www.  j  ava  2 s  . c  o  m*/
public void resetExample() {

    dataset = createDataset(true);

    JFreeChart chart = createChart(dataset);
    chartPanel = new ChartPanel(chart, false);
    setChart();

    hasExample = true;
    convertor.valueList2Table_vertical(values_storage, SERIES_COUNT, CATEGORY_COUNT);
    JTable tempDataTable = convertor.getTable();
    resetTableRows(tempDataTable.getRowCount());
    resetTableColumns(tempDataTable.getColumnCount());

    for (int i = 0; i < tempDataTable.getColumnCount(); i++) {
        columnModel.getColumn(i).setHeaderValue(tempDataTable.getColumnName(i));
        //  System.out.println("updateExample tempDataTable["+i+"] = " +tempDataTable.getColumnName(i));
    }

    columnModel = dataTable.getColumnModel();
    dataTable.setTableHeader(new EditableHeader(columnModel));

    for (int i = 0; i < tempDataTable.getRowCount(); i++)
        for (int j = 0; j < tempDataTable.getColumnCount(); j++) {
            dataTable.setValueAt(tempDataTable.getValueAt(i, j), i, j);
        }
    dataPanel.removeAll();
    dataPanel.add(new JScrollPane(dataTable));
    dataTable.setGridColor(Color.gray);
    dataTable.setShowGrid(true);
    dataTable.doLayout();
    // this is a fix for the BAD SGI Java VM - not up to date as of dec. 22, 2003
    try {
        dataTable.setDragEnabled(true);
    } catch (Exception e) {
    }

    dataPanel.validate();

    // do the mapping
    setMapping();

    updateStatus(url);
}

From source file:adams.flow.sink.JFreeChartPlot.java

/**
 * Creates a new display panel for the token.
 *
 * @param token   the token to display in a new panel, can be null
 * @return      the generated panel/*  w  ww.j ava 2s . co  m*/
 */
@Override
public DisplayPanel createDisplayPanel(Token token) {
    AbstractDisplayPanel result;

    result = new AbstractComponentDisplayPanel(getClass().getSimpleName()) {
        private static final long serialVersionUID = -3785685146120118884L;
        protected JFreeChart m_JFreeChart;
        protected ChartPanel m_PlotPanel;

        @Override
        protected void initGUI() {
            super.initGUI();
            setLayout(new BorderLayout());
        }

        @Override
        public void display(Token token) {
            SpreadSheet sheet = (SpreadSheet) token.getPayload();
            Dataset dataset = m_Dataset.generate(sheet);
            m_JFreeChart = m_Chart.generate(dataset);
            if (m_JFreeChart.getPlot() instanceof XYPlot) {
                XYPlot plot = (XYPlot) m_JFreeChart.getPlot();
                plot.setDomainGridlinesVisible(true);
                plot.setDomainGridlinePaint(Color.GRAY);
                plot.setRangeGridlinesVisible(true);
                plot.setRangeGridlinePaint(Color.GRAY);
                plot.getRenderer().setSeriesPaint(0, m_PlotColor);
                if (plot.getSeriesCount() > 1)
                    plot.getRenderer().setSeriesPaint(1, m_DiagonalColor);
                Shape shape = m_Shape.generate();
                if (shape != null)
                    plot.getRenderer().setSeriesShape(0, shape);
            }
            m_PlotPanel = new ChartPanel(m_JFreeChart);
            removeAll();
            add(m_PlotPanel, BorderLayout.CENTER);
        }

        @Override
        public void clearPanel() {
            removeAll();
            m_JFreeChart = null;
        }

        @Override
        public void cleanUp() {
            removeAll();
            m_JFreeChart = null;
        }

        @Override
        public JComponent supplyComponent() {
            return m_PlotPanel;
        }
    };

    if (token != null)
        result.display(token);

    return result;
}

From source file:net.fenyo.gnetwatch.GUI.BasicComponent.java

/**
 * Displays the number of frames per second.
 * @param fps frames per second to display.
 * @return void.//from  ww w .j  ava 2s .  c  o  m
 */
// AWT thread
private void paintFPS(final int fps) {
    backing_g.setColor(Color.GRAY);
    if (!manual_mode) {
        //  traduire
        backing_g.drawString(fps + " frames/s - press any key or mouse button to enter manual scaling mode", 1,
                13);
        backing_g.setColor(Color.YELLOW);
        backing_g.drawString("AUTO", 60, 50);
    } else {
        //  traduire
        backing_g.drawString(
                "keys: '<' horiz. scale down  '>' horiz. scale up  '-' vert. scale down  '+' vert. scale up  'n' current date  'a' automatic scaling mode",
                1, 13);
        backing_g.setColor(Color.YELLOW);
        backing_g.drawString("MANUAL", 60, 50);
    }
}

From source file:com.juanhg.pot.PotApplet.java

void initPlot() {
    Stroke stroke = new BasicStroke(2f);

    chartPot.drawBox(potInfXLimit, potInfYLimit, potSupXLimit, potInfYLimit + 1, stroke, Color.BLACK,
            Color.GRAY);
    chartPot.drawBox(potInfXLimit, potInfYLimit, potInfXLimit + 0.18, potSupYLimit, stroke, Color.BLACK,
            Color.GRAY);//from  ww w .j  a  va 2 s  .c  o m
    chartPot.drawBox(potSupXLimit - 0.18, potInfYLimit, potSupXLimit, potSupYLimit, stroke, Color.BLACK,
            Color.GRAY);
    chartPot.drawBox(potInfXLimit - 1, potInfYLimit - 1, potSupXLimit + 1, potInfYLimit, stroke, Color.BLACK,
            Color.BLACK);
    chartPot.drawBox(potInfXLimit - 1, infYLimit + 2, potInfXLimit - 1 + 0.22, potInfYLimit, stroke,
            Color.BLACK, Color.BLACK);
    chartPot.drawBox(potSupXLimit + 0.78, infYLimit + 2, potSupXLimit + 1, potInfYLimit, stroke, Color.BLACK,
            Color.BLACK);

}