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:de.bley.word.menu.GuiMenu.java

/**
 * Kmponenten der Oberflaeche werden Initialisiert.
 *//* ww  w. j av  a  2s. c  o  m*/
public GuiMenu() {
    instance = this;
    setBounds(0, 0, Toolkit.getDefaultToolkit().getScreenSize().width / 4,
            Toolkit.getDefaultToolkit().getScreenSize().height / 2);
    setLocationRelativeTo(null);
    menuPanel = new MenuBarPanel();
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setLayout(new BorderLayout());
    panel = new JPanel(new BorderLayout());
    panel.setBackground(Color.LIGHT_GRAY);
    textfield = new JTextArea();
    panel.add(textfield);
    JScrollPane scr = new JScrollPane(textfield, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    panel.add(scr);
    button = new JButton();
    button.setText("Save");
    addListener();

}

From source file:statistic.graph.XYChart.java

public XYChart(String title, String xAxisLabel, String yAxis, XYSeriesCollection collection, boolean linear) {
    super(title, JFreeChart.DEFAULT_TITLE_FONT, new XYPlot(), true);
    this.collection = collection;
    setBackgroundPaint(Color.WHITE);
    setTitle(title);/*  w w w  .j a  v  a  2s. c o  m*/
    plot = (XYPlot) getPlot();
    plot.setDataset(collection);
    if (linear) {
        plot.setRenderer(new DefaultXYItemRenderer());
    } else {
        plot.setRenderer(new XYStepRenderer());
    }
    plot.setOrientation(PlotOrientation.VERTICAL);
    initXAxis(xAxisLabel);
    plot.setRangeAxis(new NumberAxis(yAxis));
    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);
}

From source file:dinamica.SyncChartOutput.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 = null;/*from  w w  w .ja  v  a  2 s.  c  o m*/
    synchronized (data) {
        chart = obj.getChart(chartinfo, data);
    }

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

    //set border and legend params
    chart.setBorderPaint(Color.LIGHT_GRAY);
    chart.setBorderVisible(true);
    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:MainClass.java

public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    Insets insets = getBorderInsets(c);
    Color horizontalColor;// w  ww.j  av a 2 s  .c om
    Color verticalColor;
    if (c.isEnabled()) {
        boolean pressed = false;
        if (c instanceof AbstractButton) {
            ButtonModel model = ((AbstractButton) c).getModel();
            pressed = model.isPressed();
        }
        if (pressed) {
            horizontalColor = Color.WHITE;
            verticalColor = Color.BLACK;
        } else {
            horizontalColor = Color.BLACK;
            verticalColor = Color.WHITE;
        }
    } else {
        horizontalColor = Color.LIGHT_GRAY;
        verticalColor = Color.LIGHT_GRAY;
    }
    g.setColor(horizontalColor);

    g.translate(x, y);

    // top
    g.fillRect(0, 0, width, insets.top);
    // bottom
    g.fillRect(0, height - insets.bottom, width, insets.bottom);

    g.setColor(verticalColor);
    // left
    g.fillRect(0, insets.top, insets.left, height - insets.top - insets.bottom);
    // right
    g.fillRect(width - insets.right, insets.top, insets.right, height - insets.top - insets.bottom);
    g.translate(-x, -y);
}

From source file:net.sf.dynamicreports.test.jasper.chart.ThermometerChartTest.java

@Override
protected void configureReport(JasperReportBuilder rb) {
    Locale.setDefault(Locale.ENGLISH);

    rb.setLocale(Locale.ENGLISH).summary(cht.thermometerChart().setValue(field("field1", Integer.class))
            .setDataRangeLowExpression(3).setDataRangeHighExpression(30).setValueColor(Color.BLUE)
            .setValueMask("#,###.0").setValueFont(stl.fontArial()).setValueLocation(ValueLocation.BULB)
            .setMercuryColor(Color.LIGHT_GRAY).setLowDataRangeLowExpression(8).setLowDataRangeHighExpression(10)
            .setMediumDataRangeLowExpression(18).setMediumDataRangeHighExpression(20)
            .setHighDataRangeLowExpression(28).setHighDataRangeHighExpression(30),
            cht.thermometerChart().setValue(field("field1", Integer.class)));
}

From source file:net.sf.dynamicreports.test.jasper.chart.MeterChartTest.java

@Override
protected void configureReport(JasperReportBuilder rb) {
    Locale.setDefault(Locale.ENGLISH);

    rb.setLocale(Locale.ENGLISH).summary(cht.meterChart().setValue(field("field1", Integer.class))
            .setDataRangeLowExpression(3).setDataRangeHighExpression(30).setValueColor(Color.BLUE)
            .setValueMask("#,###.0").setValueFont(stl.fontArial()).setShape(MeterShape.CIRCLE)
            .setMeterAngle(270).setUnits("units").setTickInterval(3d).setMeterBackgroundColor(Color.LIGHT_GRAY)
            .setNeedleColor(Color.CYAN).setTickColor(Color.MAGENTA).setTickLabelFont(stl.fontCourierNew())
            .intervals(/*from   ww w. j a  va 2s. co m*/
                    cht.meterInterval().setLabel("red").setAlpha(0.8).setBackgroundColor(Color.RED)
                            .setDataRangeLowExpression(25).setDataRangeHighExpression(30),
                    cht.meterInterval().setLabel("yellow").setAlpha(0.5).setBackgroundColor(Color.YELLOW)
                            .setDataRangeLowExpression(20).setDataRangeHighExpression(25)),
            cht.meterChart().setValue(5).setShape(MeterShape.DIAL));
}

From source file:org.gbif.portal.web.util.ChartUtils.java

/**
 * Writes out the image using the supplied file name.
 * /*from  w  ww . ja v a 2  s  . c om*/
 * @param legend
 * @param fileName
 * @return
 */
public static String writePieChartImageToTempFile(Map<String, Double> legend, String fileName) {

    String filePath = System.getProperty(tmpDirSystemProperty) + File.separator + fileName + defaultExtension;
    File fileToCheck = new File(filePath);
    if (fileToCheck.exists()) {
        return fileName + defaultExtension;
    }

    final DefaultPieDataset data = new DefaultPieDataset();
    Set<String> keys = legend.keySet();
    for (String key : keys) {
        logger.info("Adding key : " + key);
        data.setValue(key, legend.get(key));
    }

    // create a pie chart...
    final boolean withLegend = true;
    final JFreeChart chart = ChartFactory.createPieChart(null, data, withLegend, false, false);

    PiePlot piePlot = (PiePlot) chart.getPlot();
    piePlot.setLabelFont(new Font("Arial", Font.PLAIN, 10));
    piePlot.setLabelBackgroundPaint(Color.WHITE);

    LegendTitle lt = chart.getLegend();
    lt.setBackgroundPaint(Color.WHITE);
    lt.setWidth(300);
    lt.setBorder(0, 0, 0, 0);
    lt.setItemFont(new Font("Arial", Font.PLAIN, 11));

    chart.setPadding(new RectangleInsets(0, 0, 0, 0));
    chart.setBorderVisible(false);
    chart.setBackgroundImageAlpha(0);
    chart.setBackgroundPaint(Color.WHITE);
    chart.setBorderPaint(Color.LIGHT_GRAY);

    final BufferedImage image = new BufferedImage(300, 250, BufferedImage.TYPE_INT_RGB);
    KeypointPNGEncoderAdapter adapter = new KeypointPNGEncoderAdapter();
    adapter.setQuality(1);
    try {
        adapter.encode(image);
    } catch (IOException e) {
        logger.error(e.getMessage(), e);
    }
    final Graphics2D g2 = image.createGraphics();
    g2.setFont(new Font("Arial", Font.PLAIN, 11));
    final Rectangle2D chartArea = new Rectangle2D.Double(0, 0, 300, 250);

    // draw
    chart.draw(g2, chartArea, null, null);

    try {
        FileOutputStream fOut = new FileOutputStream(fileToCheck);
        ChartUtilities.writeChartAsPNG(fOut, chart, 300, 250);
        return fileToCheck.getName();
    } catch (IOException e) {
        logger.error(e.getMessage(), e);
        return null;
    }
}

From source file:DashboardInterface.TensionSpeedDial.java

public TensionSpeedDial(JPanel parentIn) {
    super(new BorderLayout());
    parent = parentIn;// w w  w  .  j  av  a  2 s .  co m
    dataset1 = new DefaultValueDataset(0D);
    dataset2 = new DefaultValueDataset(0D);
    pipe = MessagePipeline.getInstance();
    pipe.attach(this);
    DialPlot dialplot = new DialPlot();
    dialplot.setView(0.0D, 0.0D, 1.0D, 1.0D);
    dialplot.setDataset(0, dataset1);
    dialplot.setDataset(1, dataset2);
    setBackground(Color.WHITE);
    StandardDialFrame standarddialframe = new StandardDialFrame();
    standarddialframe.setBackgroundPaint(Color.lightGray);
    standarddialframe.setForegroundPaint(Color.darkGray);

    dialplot.setDialFrame(standarddialframe);

    DialBackground dialbackground = new DialBackground(Color.LIGHT_GRAY);

    dialbackground.setGradientPaintTransformer(
            new StandardGradientPaintTransformer(GradientPaintTransformType.VERTICAL));
    dialplot.setBackground(dialbackground);

    DialTextAnnotation dialtextannotation = new DialTextAnnotation("Tension (lbf)");
    dialtextannotation.setFont(new Font("Dialog", 1, 12));
    dialtextannotation.setPaint(Color.RED);
    dialtextannotation.setRadius(0.47999999999999996D);
    dialplot.addLayer(dialtextannotation);

    DialTextAnnotation dialtextannotation2 = new DialTextAnnotation("Speed (kts)");
    dialtextannotation2.setFont(new Font("Dialog", 1, 12));
    dialtextannotation2.setPaint(Color.BLUE);
    dialtextannotation2.setRadius(0.78999999999999996D);
    dialplot.addLayer(dialtextannotation2);

    /*DialValueIndicator dialvalueindicator = new DialValueIndicator(0);
    dialvalueindicator.setFont(new Font("Dialog", 0, 10));
    dialvalueindicator.setOutlinePaint(Color.BLACK);
    dialvalueindicator.setRadius(0.84999999999999998D);
    dialvalueindicator.setAngle(-90D);
    dialplot.addLayer(dialvalueindicator);
            
    DialValueIndicator dialvalueindicator1 = new DialValueIndicator(1);
    dialvalueindicator1.setFont(new Font("Dialog", 0, 10));
    dialvalueindicator1.setOutlinePaint(Color.BLACK);
    dialvalueindicator1.setRadius(0.60999999999999998D);
    dialvalueindicator1.setAngle(-90D);
    dialplot.addLayer(dialvalueindicator1);*/

    StandardDialScale standarddialscale = new StandardDialScale(0D, 90D, -120D, -300D, 10D, 4);
    standarddialscale.setTickRadius(0.88D);
    standarddialscale.setTickLabelOffset(0.14999999999999999D);
    standarddialscale.setTickLabelFont(new Font("Dialog", 0, 14));
    standarddialscale.setTickLabelPaint(Color.BLUE);
    standarddialscale.setMajorTickPaint(Color.BLUE);
    standarddialscale.setMinorTickPaint(Color.BLUE);
    dialplot.addScale(0, standarddialscale);

    StandardDialScale standarddialscale1 = new StandardDialScale(0.0D, 2500D, -120D, -300D, 500D, 4);
    standarddialscale1.setTickRadius(0.5D);
    standarddialscale1.setTickLabelOffset(0.14999999999999999D);
    standarddialscale1.setTickLabelFont(new Font("Dialog", 0, 10));
    standarddialscale1.setTickLabelPaint(Color.RED);
    standarddialscale1.setMajorTickPaint(Color.RED);
    standarddialscale1.setMinorTickPaint(Color.RED);
    dialplot.addScale(1, standarddialscale1);

    dialplot.mapDatasetToScale(1, 1);

    org.jfree.chart.plot.dial.DialPointer.Pointer pointer = new org.jfree.chart.plot.dial.DialPointer.Pointer(
            0);
    pointer.setFillPaint(Color.BLUE);
    dialplot.addPointer(pointer);

    org.jfree.chart.plot.dial.DialPointer.Pointer pin = new org.jfree.chart.plot.dial.DialPointer.Pointer(1);
    pin.setRadius(0.55000000000000004D);
    pin.setFillPaint(Color.RED);
    dialplot.addPointer(pin);

    DialCap dialcap = new DialCap();
    dialcap.setRadius(0.10000000000000001D);
    dialplot.setCap(dialcap);

    Dimension size = parent.getBounds().getSize();
    int width = parent.getWidth();
    int height = parent.getHeight();

    width = 200;

    JFreeChart jfreechart = new JFreeChart(dialplot);
    jfreechart.setBackgroundPaint(Color.WHITE);
    ChartPanel chartpanel = new ChartPanel(jfreechart);
    chartpanel.setPreferredSize(new Dimension(width, width));

    add(chartpanel);
}

From source file:gui.statistic.JChartPanel.java

protected static JFreeChart createChart() {
    categoryDataset = new DefaultCategoryDataset();
    //categoryDataset.addValue(20, "", "A");
    //categoryDataset.addValue(35, "", "A");
    //categoryDataset.addValue(40, "", "B");
    //categoryDataset.addValue(60, "", "B");

    JFreeChart chart = ChartFactory.createBarChart("", // Title
            "Belegungen", // X-Axis label
            "Werte", // Y-Axis label
            categoryDataset, // Dataset
            PlotOrientation.VERTICAL, false, true, false // Show legend
    );/* ww  w .  j  av  a  2s.co  m*/

    chart.setBackgroundPaint(Color.WHITE);

    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    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);

    return chart;

}

From source file:facturas.Facture.java

/**
 * Creates new form Facture//from   w  w  w  .j  a  va2 s  .  co m
 */
public Facture() {
    initComponents();
    setIconImage(new ImageIcon(getClass().getResource("/Images/icono.png")).getImage());
    this.setTitle("Facture Application");
    this.setLocationRelativeTo(null);
    getRootPane().setDefaultButton(jButtonPrecioTotal);
    //Hacemos que los campos jText Field siguientes no puedan ser editables
    jTextFieldIva.setEditable(false);
    jTextFieldIva.setForeground(Color.BLUE);
    jTextFieldIva1.setEditable(false);
    jTextFieldIva1.setForeground(Color.BLUE);
    jTextFieldIva2.setEditable(false);
    jTextFieldIva2.setForeground(Color.BLUE);
    jTextFieldIva3.setEditable(false);
    jTextFieldIva3.setForeground(Color.BLUE);
    jTextFieldTotal.setEditable(false);
    jTextFieldTotal.setForeground(Color.BLUE);
    jTextFieldTotal1.setEditable(false);
    jTextFieldTotal1.setForeground(Color.BLUE);
    jTextFieldTotal2.setEditable(false);
    jTextFieldTotal2.setForeground(Color.BLUE);
    jTextFieldTotal3.setEditable(false);
    jTextFieldTotal3.setForeground(Color.BLUE);
    jTextFieldTotalPrice.setEditable(false);
    jTextFieldTotalPrice.setForeground(Color.RED);
    jTextFieldTotalPrice.setBackground(Color.LIGHT_GRAY);
}