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:com.xilinx.kintex7.PowerDial.java

public void createDial() {
    plot = new MeterPlot();
    dset = new DefaultValueDataset(0);
    plot.setUnits("Watts");
    plot.setRange(new Range(1, 10));
    plot.addInterval(new MeterInterval("Acceptable", new Range(1.0, 6.0), Color.lightGray,
            new BasicStroke(2.0f), Color.GREEN));
    plot.addInterval(new MeterInterval("Warning", new Range(6.0, 8.0), Color.lightGray, new BasicStroke(2.0f),
            Color.YELLOW));/*  w  w  w .  j a  va 2s . com*/
    plot.addInterval(new MeterInterval("Dangerous", new Range(8.0, 10.0), Color.lightGray,
            new BasicStroke(2.0f), Color.RED));

    //sets different marks
    for (int i = 0; i < 10; i += 1) {
        if (i == 0)
            plot.addInterval(
                    new MeterInterval("", new Range(1, 1), Color.lightGray, new BasicStroke(2.0f), null));
        else
            plot.addInterval(
                    new MeterInterval("", new Range(i, i), Color.lightGray, new BasicStroke(2.0f), null));
    }
    plot.setNeedlePaint(Color.darkGray);
    plot.setDialBackgroundPaint(Color.white);
    plot.setDialOutlinePaint(Color.gray);
    plot.setDialShape(DialShape.PIE);
    plot.setMeterAngle(180);
    plot.setTickLabelsVisible(true);
    plot.setTickLabelFont(new Font("Dialog", Font.BOLD, 10));
    plot.setTickLabelPaint(Color.DARK_GRAY);
    plot.setTickSize(10.0);
    plot.setTickPaint(Color.lightGray);
    plot.setValuePaint(Color.BLACK);
    plot.setDataset(dset);

    LegendItemCollection legendItemsOld = plot.getLegendItems();
    final LegendItemCollection legendItemsNew = new LegendItemCollection();

    for (int i = 0; i < 3; i++) {
        LegendItem item = legendItemsOld.get(i);
        item.setLabelPaint(Color.WHITE);
        legendItemsNew.add(item);
    }

    LegendItemSource source = new LegendItemSource() {
        LegendItemCollection lic = new LegendItemCollection();
        {
            lic.addAll(legendItemsNew);
        }

        @Override
        public LegendItemCollection getLegendItems() {
            return lic;
        }
    };

    chart = new JFreeChart(plot);
    chart.addLegend(new LegendTitle(source));
    chart.removeLegend();
    chart.setTitle("");
    //chart.setBackgroundPaint(new GradientPaint(0,0,new Color(139,137,137),0,height,Color.BLUE ));
    //
    chart.getTitle().setPaint(Color.white);
    plot.setValueFont(new Font("Dialog", Font.BOLD, 14));
    //chartpanel = new ChartPanel(chart);
}

From source file:com.edduarte.protbox.ui.windows.RestoreFileWindow.java

private RestoreFileWindow(final PReg registry) {
    super();/*  w  w  w  .  ja  v a 2 s  .  com*/
    setLayout(null);

    final JTextField searchField = new JTextField();
    searchField.setLayout(null);
    searchField.setBounds(2, 2, 301, 26);
    searchField.setBorder(new LineBorder(Color.lightGray));
    searchField.setFont(Constants.FONT);
    add(searchField);

    final JLabel noBackupFilesLabel = new JLabel("<html>No backups files were found!<br><br>"
            + "<font color=\"gray\">If you think there is a problem with the<br>"
            + "backup system, please create an issue here:<br>"
            + "<a href=\"#\">https://github.com/com.edduarte/protbox/issues</a></font></html>");
    noBackupFilesLabel.setLayout(null);
    noBackupFilesLabel.setBounds(20, 50, 300, 300);
    noBackupFilesLabel.setFont(Constants.FONT.deriveFont(14f));
    noBackupFilesLabel.addMouseListener((OnMouseClick) e -> {
        String urlPath = "https://github.com/com.edduarte/protbox/issues";

        try {

            if (Desktop.isDesktopSupported()) {
                Desktop.getDesktop().browse(new URI(urlPath));

            } else {
                if (SystemUtils.IS_OS_WINDOWS) {
                    Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + urlPath);

                } else {
                    java.util.List<String> browsers = Lists.newArrayList("firefox", "opera", "safari",
                            "mozilla", "chrome");

                    for (String browser : browsers) {
                        if (Runtime.getRuntime().exec(new String[] { "which", browser }).waitFor() == 0) {

                            Runtime.getRuntime().exec(new String[] { browser, urlPath });
                            break;
                        }
                    }
                }
            }

        } catch (Exception ex) {
            ex.printStackTrace();
        }
    });

    DefaultMutableTreeNode rootTreeNode = registry.buildEntryTree();
    final JTree tree = new JTree(rootTreeNode);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    if (rootTreeNode.getChildCount() == 0) {
        searchField.setEnabled(false);
        add(noBackupFilesLabel);
    }
    expandTree(tree);
    tree.setLayout(null);
    tree.setRootVisible(false);
    tree.setEditable(false);
    tree.setCellRenderer(new SearchableTreeCellRenderer(searchField));
    searchField.addKeyListener((OnKeyReleased) e -> {

        // update and expand tree
        DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
        model.nodeStructureChanged((TreeNode) model.getRoot());
        expandTree(tree);
    });
    final JScrollPane scroll = new JScrollPane(tree, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scroll.setBorder(new DropShadowBorder());
    scroll.setBorder(new LineBorder(Color.lightGray));
    scroll.setBounds(2, 30, 334, 360);
    add(scroll);

    JLabel close = new JLabel(new ImageIcon(Constants.getAsset("close.png")));
    close.setLayout(null);
    close.setBounds(312, 7, 18, 18);
    close.setFont(Constants.FONT);
    close.setForeground(Color.gray);
    close.addMouseListener((OnMouseClick) e -> dispose());
    add(close);

    final JLabel permanentDeleteButton = new JLabel(new ImageIcon(Constants.getAsset("permanent.png")));
    permanentDeleteButton.setLayout(null);
    permanentDeleteButton.setBounds(91, 390, 40, 39);
    permanentDeleteButton.setBackground(Color.black);
    permanentDeleteButton.setEnabled(false);
    permanentDeleteButton.addMouseListener((OnMouseClick) e -> {
        if (permanentDeleteButton.isEnabled()) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
            PbxEntry entry = (PbxEntry) node.getUserObject();

            if (JOptionPane.showConfirmDialog(null,
                    "Are you sure you wish to permanently delete '" + entry.realName()
                            + "'?\nThis file and its "
                            + "backup copies will be deleted immediately. You cannot undo this action.",
                    "Confirm Cancel", JOptionPane.YES_NO_OPTION,
                    JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) {

                registry.permanentDelete(entry);
                dispose();
                RestoreFileWindow.getInstance(registry);

            } else {
                setVisible(true);
            }
        }
    });
    add(permanentDeleteButton);

    final JLabel configBackupsButton = new JLabel(new ImageIcon(Constants.getAsset("config.png")));
    configBackupsButton.setLayout(null);
    configBackupsButton.setBounds(134, 390, 40, 39);
    configBackupsButton.setBackground(Color.black);
    configBackupsButton.setEnabled(false);
    configBackupsButton.addMouseListener((OnMouseClick) e -> {
        if (configBackupsButton.isEnabled()) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
            PbxEntry entry = (PbxEntry) node.getUserObject();
            if (entry instanceof PbxFile) {
                PbxFile pbxFile = (PbxFile) entry;

                JFrame frame = new JFrame("Choose backup policy");
                Object option = JOptionPane.showInputDialog(frame,
                        "Choose below the backup policy for this file:", "Choose backup",
                        JOptionPane.QUESTION_MESSAGE, null, PbxFile.BackupPolicy.values(),
                        pbxFile.getBackupPolicy());

                if (option == null) {
                    setVisible(true);
                    return;
                }
                PbxFile.BackupPolicy pickedPolicy = PbxFile.BackupPolicy.valueOf(option.toString());
                pbxFile.setBackupPolicy(pickedPolicy);
            }
            setVisible(true);
        }
    });
    add(configBackupsButton);

    final JLabel restoreBackupButton = new JLabel(new ImageIcon(Constants.getAsset("restore.png")));
    restoreBackupButton.setLayout(null);
    restoreBackupButton.setBounds(3, 390, 85, 39);
    restoreBackupButton.setBackground(Color.black);
    restoreBackupButton.setEnabled(false);
    restoreBackupButton.addMouseListener((OnMouseClick) e -> {
        if (restoreBackupButton.isEnabled()) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
            PbxEntry entry = (PbxEntry) node.getUserObject();
            if (entry instanceof PbxFolder) {
                registry.restoreFolderFromEntry((PbxFolder) entry);

            } else if (entry instanceof PbxFile) {
                PbxFile pbxFile = (PbxFile) entry;
                java.util.List<String> snapshots = pbxFile.snapshotsToString();
                if (snapshots.isEmpty()) {
                    setVisible(true);
                    return;
                }

                JFrame frame = new JFrame("Choose backup");
                Object option = JOptionPane.showInputDialog(frame,
                        "Choose below what backup snapshot would you like restore:", "Choose backup",
                        JOptionPane.QUESTION_MESSAGE, null, snapshots.toArray(), snapshots.get(0));

                if (option == null) {
                    setVisible(true);
                    return;
                }
                int pickedIndex = snapshots.indexOf(option.toString());
                registry.restoreFileFromEntry((PbxFile) entry, pickedIndex);
            }
            dispose();
        }
    });
    add(restoreBackupButton);

    tree.addMouseListener((OnMouseClick) e -> {
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
        if (node != null) {
            PbxEntry entry = (PbxEntry) node.getUserObject();
            if ((entry instanceof PbxFolder && entry.areNativeFilesDeleted())) {
                permanentDeleteButton.setEnabled(true);
                restoreBackupButton.setEnabled(true);
                configBackupsButton.setEnabled(false);

            } else if (entry instanceof PbxFile) {
                permanentDeleteButton.setEnabled(true);
                restoreBackupButton.setEnabled(true);
                configBackupsButton.setEnabled(true);

            } else {
                permanentDeleteButton.setEnabled(false);
                restoreBackupButton.setEnabled(false);
                configBackupsButton.setEnabled(false);
            }
        }
    });

    final JLabel cancel = new JLabel(new ImageIcon(Constants.getAsset("cancel.png")));
    cancel.setLayout(null);
    cancel.setBounds(229, 390, 122, 39);
    cancel.setBackground(Color.black);
    cancel.addMouseListener((OnMouseClick) e -> dispose());
    add(cancel);

    addWindowFocusListener(new WindowFocusListener() {
        private boolean gained = false;

        @Override
        public void windowGainedFocus(WindowEvent e) {
            gained = true;
        }

        @Override
        public void windowLostFocus(WindowEvent e) {
            if (gained) {
                dispose();
            }
        }
    });

    setSize(340, 432);
    setUndecorated(true);
    getContentPane().setBackground(Color.white);
    setResizable(false);
    getRootPane().setBorder(BorderFactory.createLineBorder(new Color(100, 100, 100)));
    Utils.setComponentLocationOnCenter(this);
    setVisible(true);
}

From source file:flexflux.analyses.result.TDRFBAResult.java

public void plot() {

    JPanel panel = new JPanel();
    JScrollPane sp = new JScrollPane(panel);
    panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));

    // one chart by entity

    Color[] colors = new Color[] { Color.RED, Color.GREEN, Color.BLUE };
    int index = 0;
    for (String s : entities) {

        XYSeriesCollection dataset = new XYSeriesCollection();

        XYSeries series = new XYSeries(s);

        for (Double time : times) {
            series.add(time, resultMap.get(time).get(s));
        }/*from w  ww  .  j a v  a  2s.  c om*/

        final JFreeChart chart = ChartFactory.createXYLineChart(s, // chart
                // title
                "Time (h)", // domain axis label
                "Value", // range axis label
                dataset, // data
                PlotOrientation.VERTICAL, // orientation
                true, // include legend
                true, // tooltips
                false // urls
        );

        chart.setBackgroundPaint(Color.white);

        XYPlot plot = (XYPlot) chart.getPlot();

        plot.setBackgroundPaint(Color.WHITE);
        plot.setRangeGridlinePaint(Color.GRAY);
        plot.setDomainGridlinePaint(Color.GRAY);

        plot.getRenderer().setSeriesPaint(0, colors[index % colors.length]);

        index++;

        ChartPanel chartPanel = new ChartPanel(chart);

        dataset.addSeries(series);

        panel.add(chartPanel);
        panel.add(new JSeparator());

    }

    Dimension d = panel.getComponent(0).getPreferredSize();
    d.height *= 2;

    sp.getViewport().setPreferredSize(d);

    JFrame frame = new JFrame("Time-dependant FBA results");

    frame.add(sp);
    frame.pack();
    RefineryUtilities.centerFrameOnScreen(frame);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);

}

From source file:CustomIconDemo.java

public void paintIcon(Component c, Graphics g, int x, int y) {
    int length = xPoints.length;
    int adjustedXPoints[] = new int[length];
    int adjustedYPoints[] = new int[length];

    for (int i = 0; i < length; i++) {
        adjustedXPoints[i] = xPoints[i] + x;
        adjustedYPoints[i] = yPoints[i] + y;
    }/*from ww  w .  jav  a2 s  .c  o  m*/

    if (c.isEnabled()) {
        g.setColor(Color.black);
    } else {
        g.setColor(Color.gray);
    }

    g.fillPolygon(adjustedXPoints, adjustedYPoints, length);
}

From source file:edu.ucla.stat.SOCR.chart.demo.NormalDistributionDemo.java

/**
 * use demo data to reset JTable and redraw the graph
 *///from   w w  w .ja  v a 2  s  .  c  o m
public void resetExample() {

    XYDataset dataset = createDataset(true);

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

    hasExample = true;
    convertor.normalDataset2Table(mean, stdDev);
    JTable tempDataTable = convertor.getTable();
    resetTableRows(tempDataTable.getRowCount() + 1);
    resetTableColumns(tempDataTable.getColumnCount() + 2);

    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

    int columnCount = dataTable.getColumnCount();
    for (int i = 0; i < columnCount / 2 - 1; i++) {
        addButtonIndependent();
        addButtonDependent();
    }
    //updateStatus(url);
}

From source file:CalIcon.java

/** paintIcon: draw the calendar page. */
public void paintIcon(Component c, Graphics g, int x, int y) {

    // Allow clock to get painted (voodoo magic)
    if (showTime)
        super.paint(g);

    // Outline it.
    g.setColor(Color.black);//from  w  w w  .  j  a v a  2  s. c o m
    g.draw3DRect(x, y, d.width - 2, d.height - 2, true);

    // Show the date: First, a white page with a drop shadow.
    g.setColor(Color.gray);
    g.fillRect(x + RBX + 3, y + RBY + 3, RBW, RBH);
    g.setColor(Color.white);
    g.fillRect(x + RBX, y + RBY, RBW, RBH);

    // g.setColor(getForeground());
    g.setColor(Color.black);

    String s = days[myCal.get(Calendar.DAY_OF_WEEK) - 1];
    g.setFont(dayNameFont);
    int w = dayNameFM.stringWidth(s);
    g.drawString(s, x + RBX + ((RBW - w) / 2), y + RBY + 10);

    s = Integer.toString(myCal.get(Calendar.DAY_OF_MONTH));
    g.setFont(dayNumbFont);
    w = dayNumbFM.stringWidth(s);
    g.drawString(s, x + RBX + ((RBW - w) / 2), y + RBY + 25);

    s = mons[myCal.get(Calendar.MONTH)];
    g.setFont(monNameFont);
    w = monNameFM.stringWidth(s);
    g.drawString(s, x + RBX + ((RBW - w) / 2), y + RBY + 35);
}

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

private void initComponents() {
    setLayout(new MigLayout("fill", "[grow][grow]", ""));

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

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

    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);// ww w  .  ja 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]", "[19px][][19px]")); //$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$

    centerPanel.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$

    PosButton btnPrint = new com.floreantpos.swing.PosButton(POSConstants.PRINT_TICKET);
    btnPrint.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            for (Ticket ticket : groupSettleTicketView.getTickets()) {
                ReceiptPrintService.printTicket(ticket);
            }
        }
    });

    calcButtonPanel.add(btnPrint, "span 4,grow"); //$NON-NLS-1$

    centerPanel.add(calcButtonPanel, BorderLayout.CENTER);

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

    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) {
            try {
                double x = NumberUtil.parse(txtTenderedAmount.getText()).doubleValue();
                if (x <= 0) {
                    POSMessageDialog.showError(Messages.getString("PaymentView.32")); //$NON-NLS-1$
                    return;
                }
                groupSettleTicketView.doGroupSettle(PaymentType.CASH);
            } catch (Exception e) {
                org.apache.commons.logging.LogFactory.getLog(getClass()).error(e);
            }
        }
    });

    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;
                }
                groupSettleTicketView.doGroupSettle(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) {
            groupSettleTicketView.doGroupSettle(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) {
            groupSettleTicketView.doGroupSettle(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) {
            groupSettleTicketView.doGroupSettle(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(centerPanel, "cell 0 0,grow");
    add(actionButtonPanel, "cell 1 0,grow");
}

From source file:course_generator.param.frmEditCurve.java

/**
 * Create the chart/*from  w ww  .j av a  2s.co m*/
 * @param dataset Dataset to display
 * @return Return a JFreeChart object
 */
private JFreeChart CreateChartProfil(XYDataset dataset) {
    JFreeChart chart = ChartFactory.createXYAreaChart("", bundle.getString("frmEditCurve.chart.slope"), //"Slope"  x axis label
            bundle.getString("frmEditCurve.chart.speed"), //"speed"  y axis label
            dataset, // data
            PlotOrientation.VERTICAL, false, // include legend
            true, // tooltips
            false // urls
    );

    chart.setBackgroundPaint(Color.white); // Panel background color
    XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.gray);
    plot.setRangeGridlinePaint(Color.gray);

    // XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    XYAreaRenderer renderer = new XYAreaRenderer();
    // Green (safe color)
    renderer.setSeriesPaint(0, new Color(0x99, 0xff, 0x00));
    renderer.setOutline(true);
    // Width of the outline
    renderer.setSeriesOutlineStroke(0, new BasicStroke(2.0f));
    plot.setRenderer(renderer);

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

    return chart;
}

From source file:edu.mit.fss.tutorial.part4.ControlPanel.java

@Override
public void paint(Graphics g) {
    // Calls the super-class paint method for the default background.
    super.paint(g);

    // Set color to gray and draw the x-axis (Y=0) and y=axis (X=0).
    g.setColor(Color.gray);
    g.drawLine(0, getHeight() / 2, getWidth(), getHeight() / 2);
    g.drawLine(getWidth() / 2, 0, getWidth() / 2, getHeight());

    // Make sure no changes to elements can take place while painting.
    synchronized (elements) {
        // For each surface element...
        for (SurfaceElement e : elements) {
            if (e instanceof MobileElement) {
                // If it is a MobileElement, use blue color.
                g.setColor(Color.blue);
            } else {
                // Otherwise use black color.
                g.setColor(Color.black);
            }/*from   w ww. java 2 s.  co m*/
            // Determine the screen location for the element.
            int[] location = getScreenLocation(e.getPosition());

            // Fill an oval at the location (offset by half the oval size).
            g.fillOval(location[0] - ELEMENT_SIZE / 2, location[1] - ELEMENT_SIZE / 2, ELEMENT_SIZE,
                    ELEMENT_SIZE);

            // Draw the element name to the right of the oval, offset by
            // 2 pixels to the right and half the oval size vertically.
            g.drawString(e.getName(), location[0] + ELEMENT_SIZE / 2 + 2,
                    location[1] + ELEMENT_SIZE / 2 + ELEMENT_SIZE / 2);
        }
    }
}

From source file:net.imglib2.script.analysis.Histogram.java

static private final void setBackgroundDefault(final JFreeChart chart) {
    BasicStroke gridStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f,
            new float[] { 2.0f, 1.0f }, 0.0f);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setRangeGridlineStroke(gridStroke);
    plot.setDomainGridlineStroke(gridStroke);
    plot.setBackgroundPaint(new Color(235, 235, 235));
    plot.setRangeGridlinePaint(Color.white);
    plot.setDomainGridlinePaint(Color.white);
    plot.setOutlineVisible(false);// ww  w.  j ava2s. c o m
    plot.getDomainAxis().setAxisLineVisible(false);
    plot.getRangeAxis().setAxisLineVisible(false);
    plot.getDomainAxis().setLabelPaint(Color.gray);
    plot.getRangeAxis().setLabelPaint(Color.gray);
    plot.getDomainAxis().setTickLabelPaint(Color.gray);
    plot.getRangeAxis().setTickLabelPaint(Color.gray);
    chart.getTitle().setPaint(Color.gray);
}