Example usage for java.awt Color LIGHT_GRAY

List of usage examples for java.awt Color LIGHT_GRAY

Introduction

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

Prototype

Color LIGHT_GRAY

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

Click Source Link

Document

The color light gray.

Usage

From source file:net.sourceforge.msscodefactory.cflib.v1_11.CFLib.Swing.CFHeaderColumnCellRenderer.java

public Component getTableCellRendererComponent(JTable table, Object val, boolean isSelected, boolean hasFocus,
        int row, int column) {
    value = val;/*from   w  w  w.ja v a2 s.  c  o  m*/
    setBackground(Color.LIGHT_GRAY);
    setForeground(Color.BLACK);
    return (this);
}

From source file:ed.cracken.code.SimpleTestExp1.java

private void build() {
    StyleBuilder boldStyle = stl.style().bold();
    StyleBuilder boldCenteredStyle = stl.style(boldStyle).setHorizontalAlignment(HorizontalAlignment.CENTER);
    StyleBuilder columnTitleStyle = stl.style(boldCenteredStyle).setBorder(stl.pen1Point())
            .setBackgroundColor(Color.LIGHT_GRAY);

    //                                                           title,     field name     data type
    TextColumnBuilder<String> brandColumn = col.column("Brand", "brand", type.stringType()).setStyle(boldStyle);
    TextColumnBuilder<String> itemColumn = col.column("Item", "item", type.stringType()).setStyle(boldStyle);

    TextColumnBuilder<Integer> quantityColumn = col.column("Quantity", "quantity", type.integerType());
    TextColumnBuilder<BigDecimal> unitPriceColumn = col.column("Unit price", "unitprice",
            type.bigDecimalType());//from  w  w w.j  a  v a2 s  .c om
    //price = unitPrice * quantity
    TextColumnBuilder<BigDecimal> priceColumn = unitPriceColumn.multiply(quantityColumn).setTitle("Price");
    PercentageColumnBuilder pricePercColumn = col.percentageColumn("Price %", priceColumn);
    TextColumnBuilder<Integer> rowNumberColumn = col.reportRowNumberColumn("No.")
            //sets the fixed width of a column, width = 2 * character width
            .setFixedColumns(2).setHorizontalAlignment(HorizontalAlignment.CENTER);
    try {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        report()//create new report design
                .setColumnTitleStyle(columnTitleStyle).setSubtotalStyle(boldStyle).highlightDetailEvenRows()
                .columns(//add columns
                        rowNumberColumn, brandColumn, itemColumn, quantityColumn, unitPriceColumn, priceColumn,
                        pricePercColumn)
                .groupBy(brandColumn).groupBy(itemColumn)
                //           .subtotalsAtSummary(sbt.count(rowNumberColumn),
                //              sbt.sum(unitPriceColumn), sbt.sum(priceColumn))
                .subtotalsAtFirstGroupFooter(sbt.count(rowNumberColumn), sbt.sum(unitPriceColumn),
                        sbt.sum(priceColumn))
                //           .title(cmp.text("Getting started").setStyle(boldCenteredStyle))//shows report title
                //           .pageFooter(cmp.pageXofY().setStyle(boldCenteredStyle))//shows number of page at page footer
                .setDataSource(createDataSource())//set datasource
                .show().toCsv(out);//create and show report
        String data;
        System.out.println(data = new String(out.toByteArray()));
        List<Map<?, ?>> objects = readObjectsFromCsv(data);
        //            System.out.println(new Gson().toJson(objects));
        writeAsJson(objects);
    } catch (DRException e) {
        e.printStackTrace();
    } catch (IOException ex) {
        Logger.getLogger(SimpleTestExp1.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:net.sourceforge.msscodefactory.cflib.v1_11.CFLib.Swing.CFNmTokenColumnCellRenderer.java

public Component getTableCellRendererComponent(JTable table, Object val, boolean isSelected, boolean hasFocus,
        int row, int column) {
    value = val;//from   w  ww.  j av  a2  s .c  om
    if (isSelected) {
        setBackground(Color.BLACK);
        setForeground(Color.LIGHT_GRAY);
    } else {
        setBackground(Color.LIGHT_GRAY);
        setForeground(Color.BLACK);
    }
    return (this);
}

From source file:net.sourceforge.msscodefactory.cflib.v1_11.CFLib.Swing.CFBoolColumnCellRenderer.java

public Component getTableCellRendererComponent(JTable table, Object val, boolean isSelected, boolean hasFocus,
        int row, int column) {
    value = val;//from w  ww.ja  va2s .c  om

    if (isSelected) {
        setBackground(Color.BLACK);
        setForeground(Color.LIGHT_GRAY);
    } else {
        setBackground(Color.LIGHT_GRAY);
        setForeground(Color.BLACK);
    }

    return (this);
}

From source file:dinamica.ChartOutput.java

public void print(GenericTransaction t) throws Throwable {

    //get chart parameters
    Recordset chartinfo = t.getRecordset("chartinfo");

    //get chart data
    String id = chartinfo.getString("data");
    Recordset data = (Recordset) getSession().getAttribute(id);
    if (data == null)
        throw new Throwable(
                "Invalid Recordset ID:" + id + " - The session does not contain an attribute with this ID.");

    //general chart params
    Integer width = (Integer) chartinfo.getValue("width");
    Integer height = (Integer) chartinfo.getValue("height");

    //load chart plugin
    String plugin = (String) chartinfo.getValue("chart-plugin");
    AbstractChartPlugin obj = (AbstractChartPlugin) Thread.currentThread().getContextClassLoader()
            .loadClass(plugin).newInstance();

    JFreeChart chart = obj.getChart(chartinfo, data);

    //set gradient
    chart.setBackgroundPaint(getGradient());

    //set border and legend params
    chart.setBorderPaint(Color.LIGHT_GRAY);
    chart.setBorderVisible(true);//from ww  w  . j  ava 2  s  .  co  m
    if (chart.getLegend() != null) {
        chart.getLegend().setBorder(0.2, 0.2, 0.2, 0.2);
        chart.getLegend().setPadding(5, 5, 5, 5);
        chart.getLegend().setMargin(4, 5, 4, 4);
    }

    //render chart in memory
    BufferedImage img = chart.createBufferedImage(width.intValue(), height.intValue());
    ByteArrayOutputStream b = new ByteArrayOutputStream(32768);

    //encode as PNG
    ImageIO.write(img, "png", b);

    //send bitmap via servlet output
    byte image[] = b.toByteArray();
    getResponse().setContentType("image/png");
    getResponse().setContentLength(image.length);
    OutputStream out = getResponse().getOutputStream();
    out.write(image);
    out.close();

    //save image bytes in session attribute if requested
    if (chartinfo.containsField("session")) {
        String session = chartinfo.getString("session");
        if (session != null && session.equals("true"))
            getSession().setAttribute(chartinfo.getString("image-id"), image);
    }

}

From source file:jamel.gui.charts.InstantXYZScatterChart.java

/**
 * Initialize the renderer./*from w ww.  jav  a 2  s . c  o m*/
 */
private void initXYShapeRenderer() {
    XYShapeRenderer renderer = new XYShapeRenderer();
    renderer.setSeriesOutlinePaint(0, Color.LIGHT_GRAY);
    renderer.setDrawOutlines(true);
    Shape shape = new java.awt.geom.Ellipse2D.Double(0, 0, 7, 7);
    renderer.setSeriesShape(0, shape);
    try {
        this.getXYPlot().setRenderer(1, renderer);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:GUI.GraficaView.java

private void init() {
    ArrayList<OperacionesDiarias> aux = operario.getArrayOperacionesDiarias();
    Collections.sort(aux);/* w  ww  . j  a va 2s.  c  om*/

    panel = new JPanel();
    getContentPane().add(panel);
    // Fuente de Datos
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    for (OperacionesDiarias op : aux) {
        if (op.getListaOperaciones().size() > 0) {
            dataset.setValue(op.getPorcentaje(), operario.getNombre(), op.getFecha());
        }

    }

    // Creando el Grafico
    JFreeChart chart = ChartFactory.createBarChart3D("Rendimiento", "Dia", "Porcentaje %", dataset,
            PlotOrientation.VERTICAL, true, true, false);
    chart.setBackgroundPaint(Color.LIGHT_GRAY);
    chart.getTitle().setPaint(Color.black);
    CategoryPlot p = chart.getCategoryPlot();
    p.setRangeGridlinePaint(Color.red);

    // Mostrar Grafico
    ChartPanel chartPanel = new ChartPanel(chart);
    panel.add(chartPanel);
    repaint();
}

From source file:statistic.graph.JChartPanel.java

protected static JFreeChart createChart() {
    stepDataset = new XYSeriesCollection();
    linearDataset = new XYSeriesCollection();

    chart = ChartFactory.createXYLineChart("Fluss", "Zeiteinheiten", "Flusseinheiten", stepDataset,
            PlotOrientation.VERTICAL, true, true, false);
    chart.setBackgroundPaint(Color.WHITE);

    plot = (XYPlot) chart.getPlot();//ww  w  .j a v  a2  s  . c o  m
    plot.setBackgroundPaint(Color.LIGHT_GRAY);
    plot.setDomainGridlinePaint(Color.WHITE);
    plot.setRangeGridlinePaint(Color.WHITE);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    plot.setDataset(0, stepDataset);
    plot.setDataset(1, linearDataset);

    XYItemRenderer r = plot.getRenderer();
    //r.setBaseOutlinePaint(Color.BLACK);
    //r.setBasePaint();
    //r.setItemLabelPaint();
    //r.setOutlinePaint(Color.BLACK);
    //r.setSeriesItemLabelPaint();
    //r.setSeriesOutlinePaint();
    r.setSeriesPaint(0, Color.GREEN.darker());
    r.setSeriesPaint(1, Color.MAGENTA.darker());
    if (r instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
        renderer.setBaseShapesVisible(true);
        renderer.setBaseShapesFilled(true);
    }
    //XYStepRenderer r3 = new XYStepRenderer();
    //r.setBaseOutlinePaint(Color.BLACK);
    //r.setBasePaint();
    //r.setItemLabelPaint();
    //r.setOutlinePaint(Color.BLACK);
    //r.setSeriesItemLabelPaint();
    //r.setSeriesOutlinePaint();
    //r3.setSeriesPaint(0, Color.BLACK);
    //r3.setShapesVisible(true);
    //r3.setShapesFilled(true);
    //r3.setSeriesShapesFilled(0,true);
    //r3.set
    //r3.setSeriesStroke(0, new BasicStroke(2.0f));

    XYItemRenderer r2 = new XYStepRenderer();
    r2.setSeriesPaint(2, Color.BLACK);
    plot.setRenderer(r2);
    plot.setRenderer(1, r);
    //plot.setRenderer(2, r3);

    plot.getDomainAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    plot.getDomainAxis().setRange(-0.5, 10);

    plot.getRangeAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    plot.getRangeAxis().setRange(-0.5, 8.5);

    return chart;
}

From source file:de.uzk.hki.da.sb.SIPBuilder.java

/**
 * Starts the SIP-Builder in GUI mode// w w  w. j a v a  2  s  . co m
 * 
 * @param confFolderPath Path to conf folder
 * @param dataFolderPath Path to data folder
 */
private static void startGUIMode(String confFolderPath, String dataFolderPath) {

    try {
        UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
    } catch (Exception e) {
        return;
    }

    UIManager.put("Label.disabledForeground", Color.LIGHT_GRAY);
    UIManager.put("ComboBox.disabledForeground", Color.LIGHT_GRAY);
    UIManager.put("CheckBox.disabledText", Color.LIGHT_GRAY);

    Gui gui = new Gui(confFolderPath, dataFolderPath);
    gui.setBounds(100, 100, 750, 520);
    gui.setResizable(false);
    gui.setVisible(true);
    gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    gui.setTitle("DA NRW SIP-Builder");
}

From source file:networkanalyzer.DynamicPing.java

public JFreeChart createChart(final XYDataset dataset) {
    final JFreeChart result = ChartFactory.createTimeSeriesChart("Ping Chart", //title
            "Time", //x-axis
            "Ping", //y-axis
            dataset, false, false, false);

    final XYPlot plot = result.getXYPlot();

    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinesVisible(true);
    plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.LIGHT_GRAY);

    ValueAxis xaxis = plot.getDomainAxis();
    xaxis.setAutoRange(true);//from   w  w  w .ja v  a2 s.c om

    xaxis.setFixedAutoRange(60000.0);
    xaxis.setVerticalTickLabels(true);

    ValueAxis yaxis = plot.getRangeAxis();
    yaxis.setAutoRange(true);

    return result;

}