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:net.sf.maltcms.chromaui.charts.events.TICChartHandler.java

/**
 *
 * @param v//from w ww .j  av a  2s .  c  o m
 */

@Override
public void listen(final IEvent<XYItemEntity> v) {
    if (!(v.get().getDataset() instanceof XYZDataset)) {
        Logger.getLogger(getClass().getName()).warning("Can not handle instances other than XYZDataset!");
        return;
    }
    final ValueAxis domainAxis = xypl.getDomainAxis();
    //System.out.println("Received event");
    //           Runnable r = new Runnable() {
    //            
    //            @Override
    //            public void run() {
    //               xypl.setNoDataMessage("Loading...");
    //               xypl.setDataset(null);
    //            }
    //           };
    //           
    //           SwingUtilities.invokeLater(r);
    //           
    Runnable s = new Runnable() {

        @Override
        public void run() {
            long start = System.currentTimeMillis();
            //System.out.println("Running update of TICChartHandler");
            XYItemEntity e = v.get();
            if (e.getDataset() instanceof XYZDataset) {
                final XYZDataset xyz = (XYZDataset) e.getDataset();
                final int seriesIndex = e.getSeriesIndex();
                final int y = (int) xyz.getYValue(seriesIndex, e.getItem());
                final int x = (int) xyz.getXValue(seriesIndex, e.getItem());
                XYDataset xydss;
                if (ticCache.containsKey(y)) {
                    xydss = ticCache.get(y);
                } else {
                    final DefaultXYDataset xyds = new DefaultXYDataset();
                    double[][] d = new double[2][scanlines];
                    Index idx = data.getIndex();
                    //columns, y
                    for (int j = 0; j < scanlines; j++) {
                        idx.set(scansPerMod * j + y);
                        d[0][j] = j;
                        d[1][j] = data.getDouble(idx);
                    }
                    xyds.addSeries("TIC@[" + y + "]", d);
                    xydss = xyds;
                    ticCache.put(y, xyds);
                }
                final XYDataset fds = xydss;
                Runnable runnable = new Runnable() {

                    @Override
                    public void run() {
                        xypl.setDataset(fds);
                        xypl.getRenderer().setBaseItemLabelsVisible(true);
                        xypl.getRenderer().setBasePaint(Color.GRAY);
                        xypl.getRenderer().setBaseOutlinePaint(Color.DARK_GRAY);
                        xypl.setDomainCrosshairLockedOnData(true);
                        xypl.setDomainCrosshairValue(x, true);
                        if (valueAxisFixed) {
                            xypl.getRangeAxis().setAutoRange(false);
                            xypl.getRangeAxis().setLowerBound(valueAxisMin);
                            xypl.getRangeAxis().setUpperBound(valueAxisMax);
                        } else {
                            xypl.getRangeAxis().setAutoRange(true);
                        }

                    }
                };
                SwingUtilities.invokeLater(runnable);
                //               }else{
                //                  System.err.println("Can only handle XYZDatasets!");
                //               }
                //System.out.println("Set TIC data in "+(System.currentTimeMillis()-start));
            }
        }
    };
    es.submit(s);
}

From source file:org.agmip.ui.afsirs.frames.GraphOutput.java

public void addRain() {

    XYSeries rainSeries = new XYSeries("RAIN");
    double[][] RAIN = utils.getRain();
    for (int i = 0; i < 10/*RAIN.length*/; i++) {
        for (int j = 0; j < 10/*RAIN[0].length*/; j++) {
            rainSeries.add(i * RAIN[0].length + j, RAIN[i][j]);
        }//w w w.  j a  va  2  s  . c o  m
    }

    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(rainSeries);

    JFreeChart chart = ChartFactory.createXYLineChart("Rain", "Days", "Inches",
            dataset/*,
                   PlotOrientation.VERTICAL, true, true, false*/);
    chart.setBackgroundPaint(Color.white);

    XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.GRAY);
    plot.setDomainGridlinePaint(Color.WHITE);
    plot.setRangeGridlinePaint(Color.white);

    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesLinesVisible(0, false);
    renderer.setSeriesShapesVisible(1, false);
    plot.setRenderer(renderer);

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    ChartPanel panel = new ChartPanel(chart);
    jTabbedPane1.addTab("Rain", panel);

}

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

/**
 * reset dataTable to default (demo data), and refesh chart
 *//* w  w  w.  j  av  a2  s. com*/
public void resetExample() {

    dataset = createDataset(true);

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

    hasExample = true;
    convertor.dataset2Table((TimeSeriesCollection) dataset);
    JTable tempDataTable = convertor.getTable();
    //resetTable();
    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:de.naoth.xabsleditor.graphpanel.OptionVisualizer.java

/** (Re-) set to a new graph and display it */
private void doSetGraph(Graph<XabslNode, XabslEdge> g) {
    if (g == null) {
        return;/*from   ww w. jav a  2 s. c  om*/
    }

    lastX = 0.0;
    lastY = 0.0;
    nodeCounter = 0;

    final int w = Math.max(400, this.getSize().width);
    final int h = Math.max(400, this.getSize().height);

    KKLayout<XabslNode, XabslEdge> layout = new KKLayout<XabslNode, XabslEdge>(g);
    final double nodesPerRow = Math.sqrt(g.getVertexCount());

    layout.setMaxIterations(500);
    layout.setInitializer(new Transformer<XabslNode, Point2D>() {

        @Override
        public Point2D transform(XabslNode n) {
            lastX += (w / nodesPerRow);
            nodeCounter++;
            if (nodeCounter % ((int) nodesPerRow) == 0) {
                lastX = 0;
                lastY += (h / nodesPerRow);
            }
            return new Point2D.Double(lastX, lastY);
        }
    });

    layout.setSize(new Dimension(w, h));

    if (scrollPane != null) {
        remove(scrollPane);
        scrollPane = null;
    }

    vv = new VisualizationViewer<XabslNode, XabslEdge>(layout);

    // zooming and selecting
    DefaultModalGraphMouse<XabslNode, XabslEdge> mouse = new DefaultModalGraphMouse<XabslNode, XabslEdge>();
    vv.setGraphMouse(mouse);
    vv.addKeyListener(mouse.getModeKeyListener());

    // enable selecting the nodes
    mouse.setMode(ModalGraphMouse.Mode.TRANSFORMING);

    // add external mouse listener
    if (externalMouseListener != null) {
        vv.addGraphMouseListener(externalMouseListener);
    }

    // determine the shape of the nodes
    vv.getRenderContext().setVertexShapeTransformer(new VertexTransformer());

    // white background for nodes
    vv.getRenderContext().setVertexFillPaintTransformer(new Transformer<XabslNode, Paint>() {

        @Override
        public Paint transform(XabslNode n) {
            if (n.getType() == XabslNode.Type.Option) {
                return Color.lightGray;
            } else {
                return Color.white;
            }
        }
    });

    // howto render the edges (depending whether commond decision or not)
    vv.getRenderContext().setEdgeStrokeTransformer(new Transformer<XabslEdge, Stroke>() {

        @Override
        public Stroke transform(XabslEdge e) {
            if (e.getType() == XabslEdge.Type.CommonDecision) {
                return vv.getRenderContext().DASHED;
            } else {
                return new BasicStroke();
            }
        }
    });
    vv.getRenderContext().setEdgeDrawPaintTransformer(new Transformer<XabslEdge, Paint>() {

        @Override
        public Paint transform(XabslEdge e) {
            if (e.getType() == XabslEdge.Type.CommonDecision || e.getType() == XabslEdge.Type.Outgoing) {
                return Color.gray;
            } else {
                return Color.black;
            }
        }
    });

    // use toString() to draw label and do some extra transformations (splitting at "_")
    vv.getRenderContext().setVertexLabelTransformer(new ChainedTransformer<XabslNode, String>(
            new Transformer[] { new ToStringLabeller<XabslNode>(), new Transformer<String, String>() {

                @Override
                public String transform(String s) {
                    return "<html><center>" + s.replaceAll("_", "_<br>") + "</center></html>";
                }
            } }));

    // label is placed in the center of the node
    vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR);

    // add to a zoomable container
    scrollPane = new GraphZoomScrollPane(vv);
    scrollPane.setComponentPopupMenu(pmMain);
    vv.setComponentPopupMenu(pmMain);
    add(scrollPane, BorderLayout.CENTER);
    validate();
}

From source file:org.cyberoam.iview.charts.CustomToolTipGeneratorForDiskUsage.java

/**
 * This method generates JFreeChart instance for 3D Pie chart with iView customization.
 * @param reportID specifies that for which report Chart is being prepared.
 * @param rsw specifies data set which would be used for the Chart
 * @param requeest used for Hyperlink generation from uri.
 * @return jfreechart instance with iView Customization.
 *//*from  w w w  .jav a  2s  .com*/
public static JFreeChart getChart(int reportID, ResultSetWrapper rsw, HttpServletRequest request) {
    boolean xFlag = false;
    ReportBean reportBean = ReportBean.getRecordbyPrimarykey(reportID);
    JFreeChart chart = null;
    try {
        ReportColumnBean reportColumnBean, reportColumnBeanX = null;
        GraphBean graphBean = null;
        DataLinkBean dataLinkBean = null;
        DefaultPieDataset dataset = new DefaultPieDataset();
        graphBean = GraphBean.getRecordbyPrimarykey(reportBean.getGraphId());//Getting GraphBean
        reportColumnBeanX = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(),
                graphBean.getXColumnId());//getting ReportColumnBean For X Axis
        //   String xColumnDBname = reportColumnBeanX.getDbColumnName();

        if (reportColumnBeanX.getDataLinkId() != -1) {
            dataLinkBean = DataLinkBean.getRecordbyPrimarykey(reportColumnBeanX.getDataLinkId());
        }
        reportColumnBean = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(),
                graphBean.getZColumnId());
        rsw.beforeFirst();
        reportColumnBean = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(),
                graphBean.getYColumnId());
        String yColumnName = reportColumnBean.getColumnName();
        if (dataLinkBean == null && reportColumnBean.getDataLinkId() != -1) {
            dataLinkBean = DataLinkBean.getRecordbyPrimarykey(reportColumnBean.getDataLinkId());
        }
        String xData = null;
        while (rsw.next()) {
            xData = rsw.getString(reportColumnBeanX.getDbColumnName());
            if (xData == null || "".equalsIgnoreCase(xData) || "null".equalsIgnoreCase(xData)) {
                xData = "N/A";
            } else if (reportColumnBeanX.getColumnFormat() == TabularReportConstants.PROTOCOL_FORMATTING
                    && xData.indexOf(':') != -1) {
                String data = data = ProtocolBean.getProtocolNameById(Integer.parseInt(
                        rsw.getString(reportColumnBeanX.getDbColumnName()).substring(0, xData.indexOf(':'))));
                xData = data + rsw.getString(reportColumnBeanX.getDbColumnName()).substring(xData.indexOf(':'),
                        xData.length());
            }
            dataset.setValue(xData, new Long(rsw.getLong(reportColumnBean.getDbColumnName())));
        }
        chart = ChartFactory.createPieChart3D("", // chart title
                dataset, // data
                true, // include legend
                true, // tooltips?
                false // URLs?
        );
        /*
         *Setting additional customization to the chart. 
         */
        //Set the background color for the chart...
        chart.setBackgroundPaint(Color.white);

        //Get a reference to the plot for further customisation...
        PiePlot3D plot = (PiePlot3D) chart.getPlot();
        plot.setBackgroundPaint(Color.white);
        plot.setBackgroundAlpha(0.0f);
        plot.setSectionOutlinesVisible(false);
        plot.setOutlineVisible(false);
        plot.setStartAngle(290);
        plot.setDepthFactor(0.1);
        plot.setDirection(Rotation.CLOCKWISE);
        plot.setNoDataMessage("No data to display");
        plot.setSectionOutlinesVisible(false);
        plot.setSectionOutlinePaint(Color.white);
        plot.setOutlineVisible(false);
        plot.setExplodePercent(dataset.getKey(0), 0.3);

        plot.setLabelLinkPaint(Color.gray);
        plot.setLabelBackgroundPaint(Color.white);
        plot.setLabelFont(new Font("Arial", Font.CENTER_BASELINE, 10));
        plot.setLabelOutlinePaint(Color.white);
        plot.setLabelShadowPaint(Color.white);

        LegendTitle legend = chart.getLegend();
        legend.setItemFont(new Font("Arial", Font.CENTER_BASELINE, 10));
        legend.setMargin(0, 0, 2, 0);
        legend.setHorizontalAlignment(HorizontalAlignment.CENTER);

        plot.setToolTipGenerator(new CustomToolTipGeneratorForPie3D("{0}: ({1} " + yColumnName + ", {2})"));
        //Setting Color 
        try {
            plot.setSectionPaint(dataset.getKey(0), new Color(0, 0, 254));
            plot.setSectionPaint(dataset.getKey(1), new Color(255, 0, 254));
            plot.setSectionPaint(dataset.getKey(2), new Color(176, 176, 255));
            plot.setSectionPaint(dataset.getKey(3), new Color(255, 170, 255));
            plot.setSectionPaint(dataset.getKey(4), new Color(69, 153, 204));
        } catch (Exception e) {
        }

    } catch (Exception e) {
        CyberoamLogger.appLog.debug("Pie3D.e:" + e, e);
    }
    return chart;
}

From source file:com.floreantpos.ui.views.payment.PaymentView.java

private void initComponents() {

    setLayout(new MigLayout("fill", "[grow][grow]", ""));

    JPanel leftPanel = new JPanel(new BorderLayout(5, 5));

    TransparentPanel transparentPanel1 = new TransparentPanel(new BorderLayout(5, 5));

    labelDueAmount = new javax.swing.JLabel();
    labelTenderedAmount = new javax.swing.JLabel();
    txtDueAmount = new JTextField();
    txtTenderedAmount = new JTextField();

    Font font1 = new java.awt.Font("Tahoma", 1, PosUIManager.getFontSize(20)); // NOI18N //$NON-NLS-1$
    Font font2 = new java.awt.Font("Arial", Font.PLAIN, PosUIManager.getFontSize(34)); // NOI18N //$NON-NLS-1$

    labelTenderedAmount.setFont(font1);/*w  w w .j a va  2 s.c  om*/
    labelTenderedAmount.setText(Messages.getString("PaymentView.54") + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$
    labelTenderedAmount.setForeground(Color.gray);

    txtTenderedAmount.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
    txtTenderedAmount.setFont(font1);

    labelDueAmount.setFont(font1);
    labelDueAmount.setText(Messages.getString("PaymentView.52") + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$
    labelDueAmount.setForeground(Color.gray);

    txtDueAmount.setFont(font1);
    txtDueAmount.setEditable(false);
    txtDueAmount.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

    transparentPanel1.setLayout(new MigLayout("", "[][grow,fill]", "[grow][][grow]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    transparentPanel1.add(labelDueAmount, "cell 0 0,alignx right,aligny center"); //$NON-NLS-1$

    transparentPanel1.add(labelTenderedAmount, "cell 0 2,alignx left,aligny center"); //$NON-NLS-1$
    transparentPanel1.add(txtDueAmount, "cell 1 0,growx,aligny top"); //$NON-NLS-1$
    transparentPanel1.add(txtTenderedAmount, "cell 1 2,growx,aligny top"); //$NON-NLS-1$

    leftPanel.add(transparentPanel1, BorderLayout.NORTH);

    calcButtonPanel = new com.floreantpos.swing.TransparentPanel();
    calcButtonPanel.setLayout(new MigLayout("wrap 4,fill, ins 0", "sg, fill", "sg, fill")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    btnNextAmount = new com.floreantpos.swing.PosButton();
    btnAmount1 = new com.floreantpos.swing.PosButton();
    btnAmount1.setFont(font2);

    btnAmount2 = new com.floreantpos.swing.PosButton();
    btnAmount2.setFont(font2);

    btnAmount5 = new com.floreantpos.swing.PosButton();
    btnAmount5.setFont(font2);

    btnAmount10 = new com.floreantpos.swing.PosButton();
    btnAmount10.setFont(font2);

    btnAmount20 = new com.floreantpos.swing.PosButton();
    btnAmount20.setFont(font2);

    btnAmount50 = new com.floreantpos.swing.PosButton();
    btnAmount50.setFont(font2);

    btnAmount100 = new com.floreantpos.swing.PosButton();
    btnAmount100.setFont(font2);

    btnExactAmount = new com.floreantpos.swing.PosButton();

    btn7 = new com.floreantpos.swing.PosButton();
    btn8 = new com.floreantpos.swing.PosButton();
    btn9 = new com.floreantpos.swing.PosButton();
    btn4 = new com.floreantpos.swing.PosButton();
    btn5 = new com.floreantpos.swing.PosButton();
    btn6 = new com.floreantpos.swing.PosButton();
    btn1 = new com.floreantpos.swing.PosButton();
    btn2 = new com.floreantpos.swing.PosButton();
    btn3 = new com.floreantpos.swing.PosButton();
    btn0 = new com.floreantpos.swing.PosButton();
    btnDot = new com.floreantpos.swing.PosButton();
    btnClear = new com.floreantpos.swing.PosButton();
    btn00 = new com.floreantpos.swing.PosButton();

    btnAmount1.setForeground(Color.blue);
    btnAmount1.setAction(nextButtonAction);
    btnAmount1.setText(Messages.getString("PaymentView.1")); //$NON-NLS-1$
    btnAmount1.setActionCommand("1"); //$NON-NLS-1$
    btnAmount1.setFocusable(false);
    calcButtonPanel.add(btnAmount1);

    btn7.setAction(calAction);
    btn7.setText("7");
    btn7.setFont(font2);
    //btn7.setIcon(IconFactory.getIcon("/ui_icons/", "7.png")); // NOI18N //$NON-NLS-1$ //$NON-NLS-2$
    btn7.setActionCommand("7"); //$NON-NLS-1$
    btn7.setFocusable(false);
    calcButtonPanel.add(btn7);

    btn8.setAction(calAction);
    btn8.setText("8");
    btn8.setFont(font2);
    //btn8.setIcon(IconFactory.getIcon("/ui_icons/", "8.png")); // NOI18N //$NON-NLS-1$ //$NON-NLS-2$
    btn8.setActionCommand("8"); //$NON-NLS-1$
    btn8.setFocusable(false);
    calcButtonPanel.add(btn8);

    btn9.setAction(calAction);
    btn9.setText("9");
    btn9.setFont(font2);
    //btn9.setIcon(IconFactory.getIcon("/ui_icons/", "9.png")); // NOI18N //$NON-NLS-1$ //$NON-NLS-2$
    btn9.setActionCommand("9"); //$NON-NLS-1$
    btn9.setFocusable(false);
    calcButtonPanel.add(btn9);

    btnAmount2.setForeground(Color.blue);
    btnAmount2.setAction(nextButtonAction);
    btnAmount2.setText(Messages.getString("PaymentView.10")); //$NON-NLS-1$
    btnAmount2.setActionCommand("2"); //$NON-NLS-1$
    btnAmount2.setFocusable(false);

    calcButtonPanel.add(btnAmount2);

    btn4.setAction(calAction);
    btn4.setText("4");
    btn4.setFont(font2);
    //btn4.setIcon(IconFactory.getIcon("/ui_icons/", "4.png")); // NOI18N //$NON-NLS-1$ //$NON-NLS-2$
    btn4.setActionCommand("4"); //$NON-NLS-1$
    btn4.setFocusable(false);
    calcButtonPanel.add(btn4);

    btn5.setAction(calAction);
    btn5.setText("5");
    btn5.setFont(font2);
    //btn5.setIcon(IconFactory.getIcon("/ui_icons/", "5.png")); // NOI18N //$NON-NLS-1$ //$NON-NLS-2$
    btn5.setActionCommand("5"); //$NON-NLS-1$
    btn5.setFocusable(false);
    calcButtonPanel.add(btn5);

    btn6.setAction(calAction);
    btn6.setText("6");
    btn6.setFont(font2);
    //btn6.setIcon(IconFactory.getIcon("/ui_icons/", "6.png")); // NOI18N //$NON-NLS-1$ //$NON-NLS-2$
    btn6.setActionCommand("6"); //$NON-NLS-1$
    btn6.setFocusable(false);
    calcButtonPanel.add(btn6);

    btnAmount5.setForeground(Color.blue);
    btnAmount5.setAction(nextButtonAction);
    btnAmount5.setText(Messages.getString("PaymentView.12")); //$NON-NLS-1$
    btnAmount5.setActionCommand("5"); //$NON-NLS-1$
    btnAmount5.setFocusable(false);

    calcButtonPanel.add(btnAmount5);

    btn1.setAction(calAction);
    btn1.setText("1");
    btn1.setFont(font2);
    //btn1.setIcon(IconFactory.getIcon("/ui_icons/", "1.png")); // NOI18N //$NON-NLS-1$ //$NON-NLS-2$
    btn1.setActionCommand(REMOVE);
    btn1.setFocusable(false);
    calcButtonPanel.add(btn1);

    btn2.setAction(calAction);
    btn2.setText("2");
    btn2.setFont(font2);
    //btn2.setIcon(IconFactory.getIcon("/ui_icons/", "2.png")); // NOI18N //$NON-NLS-1$ //$NON-NLS-2$
    btn2.setActionCommand("2"); //$NON-NLS-1$
    btn2.setFocusable(false);
    calcButtonPanel.add(btn2);

    btn3.setAction(calAction);
    btn3.setText("3");
    btn3.setFont(font2);
    //btn3.setIcon(IconFactory.getIcon("/ui_icons/", "3.png")); // NOI18N //$NON-NLS-1$ //$NON-NLS-2$
    btn3.setActionCommand("3"); //$NON-NLS-1$
    btn3.setFocusable(false);
    calcButtonPanel.add(btn3);

    btnAmount10.setForeground(Color.blue);
    btnAmount10.setAction(nextButtonAction);
    btnAmount10.setText(Messages.getString("PaymentView.14")); //$NON-NLS-1$
    btnAmount10.setActionCommand("10"); //$NON-NLS-1$
    btnAmount10.setFocusable(false);
    calcButtonPanel.add(btnAmount10, "grow"); //$NON-NLS-1$

    btn0.setAction(calAction);
    btn0.setText("0");
    btn0.setFont(font2);
    //btn0.setIcon(IconFactory.getIcon("/ui_icons/", "0.png")); // NOI18N //$NON-NLS-1$ //$NON-NLS-2$
    btn0.setActionCommand(ZERO);
    btn0.setFocusable(false);
    calcButtonPanel.add(btn0);

    btn00.setFont(new Font("Arial", Font.PLAIN, 30)); //$NON-NLS-1$
    btn00.setAction(calAction);
    btn00.setText(Messages.getString("PaymentView.18")); //$NON-NLS-1$
    btn00.setActionCommand("00"); //$NON-NLS-1$
    btn00.setFocusable(false);
    calcButtonPanel.add(btn00);

    btnDot.setAction(calAction);
    btnDot.setIcon(IconFactory.getIcon("/ui_icons/", "dot.png")); // NOI18N //$NON-NLS-1$ //$NON-NLS-2$
    btnDot.setActionCommand("."); //$NON-NLS-1$
    btnDot.setFocusable(false);
    calcButtonPanel.add(btnDot);

    btnAmount20.setForeground(Color.BLUE);
    btnAmount20.setAction(nextButtonAction);
    btnAmount20.setText("20"); //$NON-NLS-1$
    btnAmount20.setActionCommand("20"); //$NON-NLS-1$
    btnAmount20.setFocusable(false);
    calcButtonPanel.add(btnAmount20, "grow"); //$NON-NLS-1$

    btnAmount50.setForeground(Color.blue);
    btnAmount50.setAction(nextButtonAction);
    btnAmount50.setText("50"); //$NON-NLS-1$
    btnAmount50.setActionCommand("50"); //$NON-NLS-1$
    btnAmount50.setFocusable(false);
    calcButtonPanel.add(btnAmount50, "grow"); //$NON-NLS-1$

    btnAmount100.setForeground(Color.blue);
    btnAmount100.setAction(nextButtonAction);
    btnAmount100.setText("100"); //$NON-NLS-1$
    btnAmount100.setActionCommand("100"); //$NON-NLS-1$
    btnAmount100.setFocusable(false);
    calcButtonPanel.add(btnAmount100, "grow"); //$NON-NLS-1$

    btnClear.setAction(calAction);
    btnClear.setIcon(IconFactory.getIcon("/ui_icons/", "clear.png")); // NOI18N //$NON-NLS-1$ //$NON-NLS-2$
    btnClear.setText(Messages.getString("PaymentView.38")); //$NON-NLS-1$
    btnClear.setFocusable(false);
    calcButtonPanel.add(btnClear);

    btnExactAmount.setAction(nextButtonAction);
    btnExactAmount.setText(Messages.getString("PaymentView.20")); //$NON-NLS-1$
    btnExactAmount.setActionCommand("exactAmount"); //$NON-NLS-1$
    btnExactAmount.setFocusable(false);
    calcButtonPanel.add(btnExactAmount, "span 2,grow"); //$NON-NLS-1$

    btnNextAmount.setAction(nextButtonAction);
    btnNextAmount.setText(Messages.getString("PaymentView.23")); //$NON-NLS-1$
    btnNextAmount.setActionCommand("nextAmount"); //$NON-NLS-1$
    btnNextAmount.setFocusable(false);
    calcButtonPanel.add(btnNextAmount, "span 2,grow"); //$NON-NLS-1$

    btnGratuity = new PosButton(com.floreantpos.POSConstants.ADD_GRATUITY_TEXT);
    btnGratuity.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            doSetGratuity();
        }
    });

    //calcButtonPanel.add(btnGratuity, "split 3,span,growx"); //$NON-NLS-1$
    btnDiscount = new PosButton(com.floreantpos.POSConstants.COUPON_DISCOUNT);
    btnDiscount.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            settleTicketView.doApplyCoupon();
        }
    });
    //calcButtonPanel.add(btnDiscount, "growx"); //$NON-NLS-1$

    btnPrint = new com.floreantpos.swing.PosButton(POSConstants.PRINT_TICKET);
    btnPrint.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            ReceiptPrintService.printTicket(settleTicketView.getTicket());
        }
    });
    //   calcButtonPanel.add(btnPrint, "growx"); //$NON-NLS-1$

    JPanel panel4 = new JPanel(new GridLayout(1, 0, 5, 5));
    panel4.add(btnGratuity);
    panel4.add(btnDiscount);
    panel4.add(btnPrint);

    calcButtonPanel.add(panel4, "span 4,growx"); //$NON-NLS-1$
    leftPanel.add(calcButtonPanel, BorderLayout.CENTER);

    actionButtonPanel = new com.floreantpos.swing.TransparentPanel();
    actionButtonPanel.setOpaque(true);
    actionButtonPanel.setLayout(new MigLayout("hidemode 3,wrap 1, ins 0 20 0 0, fill", "sg, fill", "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    //actionButtonPanel.setPreferredSize(PosUIManager.getSize(120, 0));

    int width = PosUIManager.getSize(160);

    btnCash = new com.floreantpos.swing.PosButton(Messages.getString("PaymentView.31")); //$NON-NLS-1$
    actionButtonPanel.add(btnCash, "grow,w " + width + "!"); //$NON-NLS-1$ //$NON-NLS-2$
    btnCash.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            doPayByCash();
        }
    });

    PosButton btnMultiCurrencyCash = new com.floreantpos.swing.PosButton("MULTI CURRENCY CASH"); //$NON-NLS-1$
    actionButtonPanel.add(btnMultiCurrencyCash, "grow,w " + width + "!"); //$NON-NLS-1$ //$NON-NLS-2$
    btnMultiCurrencyCash.setVisible(TerminalConfig.isEnabledMultiCurrency());
    btnMultiCurrencyCash.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            try {
                List<Currency> currencyList = CurrencyUtil.getAllCurrency();
                if (currencyList.size() > 1) {
                    if (!adjustCashDrawerBalance(currencyList)) {
                        return;
                    }
                }
                double x = NumberUtil.parse(txtTenderedAmount.getText()).doubleValue();

                if (x <= 0) {
                    POSMessageDialog.showError(Messages.getString("PaymentView.32")); //$NON-NLS-1$
                    return;
                }
                settleTicketView.doSettle(PaymentType.CASH);
            } catch (Exception e) {
                org.apache.commons.logging.LogFactory.getLog(getClass()).error(e);
            }
        }
    });

    btnCreditCard = new PosButton(Messages.getString("PaymentView.33")); //$NON-NLS-1$
    actionButtonPanel.add(btnCreditCard, "grow,w " + width + "!"); //$NON-NLS-1$ //$NON-NLS-2$
    btnCreditCard.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            settleTicketView.doSettle(PaymentType.CREDIT_CARD);
        }
    });

    btnGift = new PosButton(Messages.getString("PaymentView.35")); //$NON-NLS-1$
    actionButtonPanel.add(btnGift, "grow,w " + width + "!"); //$NON-NLS-1$ //$NON-NLS-2$
    btnGift.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            settleTicketView.doSettle(PaymentType.GIFT_CERTIFICATE);
        }
    });

    btnOther = new PosButton("OTHER"); //$NON-NLS-1$
    actionButtonPanel.add(btnOther, "grow,w " + width + "!"); //$NON-NLS-1$ //$NON-NLS-2$
    btnOther.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            settleTicketView.doSettle(PaymentType.CUSTOM_PAYMENT);
        }
    });

    btnCancel = new com.floreantpos.swing.PosButton(POSConstants.CANCEL.toUpperCase());
    actionButtonPanel.add(btnCancel, "grow,w " + width + "!"); //$NON-NLS-1$ //$NON-NLS-2$
    btnCancel.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnCancelActionPerformed(evt);
        }
    });

    //rightPanel.add(actionButtonPanel, BorderLayout.EAST);

    add(leftPanel, "cell 0 0,grow");
    add(actionButtonPanel, "cell 1 0,grow");

}

From source file:edu.ucla.stat.SOCR.applications.demo.StockSimulationApplication.java

void updateGraph() {
    //System.out.println("UpdateGraph get called")
    calculate();// w  ww .  ja v  a  2s.c  o  m

    XYSeriesCollection ds = createDataset();

    JFreeChart chart = ChartFactory.createXYLineChart(title, // chart title
            xAxis, // x axis label
            yAxis, // y axis label
            ds, // data
            PlotOrientation.VERTICAL, false, // include legend
            true, // tooltips
            false // urls
    );
    chart.setBackgroundPaint(Color.white);
    XYPlot subplot1 = (XYPlot) chart.getPlot();
    XYLineAndShapeRenderer renderer1 = (XYLineAndShapeRenderer) subplot1.getRenderer();

    renderer1.setSeriesPaint(0, Color.red);
    renderer1.setSeriesPaint(1, Color.blue);
    renderer1.setSeriesPaint(2, Color.green);
    renderer1.setSeriesPaint(3, Color.gray);

    /* Shape shape = renderer1.getBaseShape();
     renderer1.setSeriesShape(2, shape);
     renderer1.setSeriesShape(3, shape);*/
    renderer1.setBaseLinesVisible(true);
    renderer1.setBaseShapesVisible(true);
    renderer1.setBaseShapesFilled(true);

    chartPanel = new ChartPanel(chart, false);
    chartPanel.setPreferredSize(new Dimension(CHART_SIZE_X, CHART_SIZE_Y));

    upContainer = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(leftPanel),
            new JScrollPane(chartPanel));

    this.getMainPanel().removeAll();
    this.getMainPanel().add(new JScrollPane(upContainer), BorderLayout.CENTER);
    this.getMainPanel().validate();
    //  getRecordTable().setText("Any Explaination goes here.");

    //
}

From source file:com.algodefu.yeti.data.Pass.java

private void calculateEquityChartImg() throws IOException {
    int i = 0;/*from  www.j  a v  a2s .  c  om*/
    double sum = 0;
    TimeSeries equity = new TimeSeries("Equity");

    // save values in temp array first, then use System.arraycopy to copy non empty values to this.equityArray
    double[][] tempEquityArr = new double[this.getTrades().length][4];

    for (Trade trade : this.getTrades()) {
        if (trade.getCloseDateTime() != null) {
            sum += trade.getProfit();
            equity.add(new Millisecond(Date.from(trade.getCloseDateTime().toInstant(ZoneOffset.UTC))), sum);
            tempEquityArr[i][0] = (double) trade.getCloseDateTime().toInstant(ZoneOffset.UTC).toEpochMilli();
            tempEquityArr[i][1] = sum;
            tempEquityArr[i][2] = trade.getTradeID();
            tempEquityArr[i][3] = trade.getProfit();
            i++;
        }
    }
    this.equityArray = new double[i][4];
    System.arraycopy(tempEquityArr, 0, this.equityArray, 0, i);

    TimeSeriesCollection dataset = new TimeSeriesCollection(equity);
    JFreeChart chart = ChartFactory.createTimeSeriesChart("", "", "", dataset, false, false, false);
    chart.getXYPlot().getDomainAxis().setTickLabelsVisible(false);
    chart.setBorderVisible(true);
    chart.getXYPlot().setRangeAxisLocation(AxisLocation.TOP_OR_RIGHT);
    chart.getXYPlot().getRenderer().setSeriesPaint(0, Color.blue);
    chart.getXYPlot().setBackgroundPaint(Color.white);
    chart.getXYPlot().setRangeGridlinePaint(Color.gray);
    chart.getXYPlot().setDomainGridlinePaint(Color.gray);
    try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
        ChartUtilities.writeChartAsPNG(baos, chart, 320, 180);
        baos.flush();
        this.equityChartByteArray = baos.toByteArray();
    } catch (IOException e) {
        throw e;
    }

}

From source file:jurls.core.utils.MatrixImage.java

@Override
public void paint(Graphics g) {

    if (image == null) {
        g.setColor(Color.GRAY);
        g.fillRect(0, 0, getWidth(), getHeight());
    } else//from  ww  w  .  ja va 2 s. c  o m
        g.drawImage(image, 0, 0, getWidth(), getHeight(), null);

}

From source file:com.github.cric.app.ui.SettingPanel.java

private JTextField textField(String defaultValue, boolean isInt) {

    JTextField field = new JTextField(defaultValue);
    addBorder(field, Color.GRAY);
    field.addFocusListener(new FocusListener() {

        @Override/*from ww  w  . j  a  v  a2 s . com*/
        public void focusLost(FocusEvent e) {

            handleFocusLost(field, isInt);
        }

        @Override
        public void focusGained(FocusEvent e) {

            addBorder(field, Color.GRAY);
            field.selectAll();
        }
    });
    return field;
}