Example usage for java.awt Color PINK

List of usage examples for java.awt Color PINK

Introduction

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

Prototype

Color PINK

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

Click Source Link

Document

The color pink.

Usage

From source file:com.mirth.connect.client.ui.panels.connectors.PollingSettingsPanel.java

private void initComponents() {
    scheduleTypeLabel = new JLabel("Schedule Type:");
    scheduleTypeComboBox = new MirthComboBox();
    // @formatter:off
    scheduleTypeComboBox// w ww .  jav  a 2  s  .  c om
            .setToolTipText("<html>This connector polls to determine when new messages have arrived.<br>"
                    + "Select \"Interval\" to poll each n units of time.<br>"
                    + "Select \"Time\" to poll once a day at the specified time.<br>"
                    + "Select \"Cron\" to poll at the specified cron expression(s).</html>");
    // @formatter:on
    scheduleTypeComboBox.addItem(PollingType.INTERVAL.getDisplayName());
    scheduleTypeComboBox.addItem(PollingType.TIME.getDisplayName());
    scheduleTypeComboBox.addItem(PollingType.CRON.getDisplayName());

    scheduleTypeActionListener = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            scheduleTypeActionPerformed();
            updateNextFireTime();
        }
    };

    nextPollLabel = new JLabel("Next poll at: ");

    yesStartPollRadioButton = new MirthRadioButton("Yes");
    yesStartPollRadioButton.setToolTipText(
            "<html>Select Yes to immediately poll once on start.<br/>All subsequent polling will follow the specified schedule.</html>");
    yesStartPollRadioButton.setBackground(UIConstants.BACKGROUND_COLOR);
    yesStartPollRadioButton.setFocusable(false);

    noStartPollRadioButton = new MirthRadioButton("No");
    noStartPollRadioButton.setToolTipText(
            "<html>Select Yes to immediately poll once on start.<br/>All subsequent polling will follow the specified schedule.</html>");
    noStartPollRadioButton.setBackground(UIConstants.BACKGROUND_COLOR);
    noStartPollRadioButton.setSelected(true);
    noStartPollRadioButton.setFocusable(false);

    pollOnStartButtonGroup = new ButtonGroup();
    pollOnStartButtonGroup.add(yesStartPollRadioButton);
    pollOnStartButtonGroup.add(noStartPollRadioButton);

    pollingTimePicker = new MirthTimePicker();
    pollingTimePicker.setToolTipText("The time of day to poll.");
    pollingTimePicker.setVisible(false);
    JSpinner.DefaultEditor editor = (JSpinner.DefaultEditor) pollingTimePicker.getEditor();
    JTextField textField = editor.getTextField();
    textField.getDocument().addDocumentListener(new DocumentListener() {
        public void insertUpdate(DocumentEvent event) {
            updateNextFireTime();
        }

        public void removeUpdate(DocumentEvent e) {
        }

        public void changedUpdate(DocumentEvent e) {
        }
    });

    pollingFrequencySettingsPanel = new JPanel();
    pollingFrequencySettingsPanel.setBackground(UIConstants.BACKGROUND_COLOR);
    pollingFrequencySettingsPanel.setVisible(true);

    pollingFrequencyField = new MirthTextField();
    pollingFrequencyField.setToolTipText(
            "<html>The specified repeating time interval.<br/>Units must be less than 24 hours of time<br/>when converted to milliseconds.</html>");
    pollingFrequencyField.setSize(new Dimension(200, 20));
    pollingFrequencyField.setDocument(new MirthFieldConstraints(0, false, false, true));
    pollingFrequencyField.getDocument().addDocumentListener(new DocumentListener() {

        @Override
        public void insertUpdate(DocumentEvent e) {
            updateNextFireTime();
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            updateNextFireTime();
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
        }
    });

    pollingFrequencyTypeComboBox = new MirthComboBox();
    pollingFrequencyTypeComboBox.setToolTipText("The interval's unit of time.");
    pollingFrequencyTypeComboBox.addItem(POLLING_FREQUENCY_MILLISECONDS);
    pollingFrequencyTypeComboBox.addItem(POLLING_FREQUENCY_SECONDS);
    pollingFrequencyTypeComboBox.addItem(POLLING_FREQUENCY_MINUTES);
    pollingFrequencyTypeComboBox.addItem(POLLING_FREQUENCY_HOURS);
    pollingFrequencyTypeComboBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            updateNextFireTime();
        }
    });

    pollingCronSettingsPanel = new JPanel();
    pollingCronSettingsPanel.setBackground(UIConstants.BACKGROUND_COLOR);
    pollingCronSettingsPanel.setVisible(false);

    cronJobsTable = new MirthTable();
    Object[][] tableData = new Object[0][1];
    cronJobsTable.setModel(new RefreshTableModel(tableData, new String[] { "Expression", "Description" }));
    cronJobsTable.setOpaque(true);
    cronJobsTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
    cronJobsTable.getTableHeader().setReorderingAllowed(false);
    cronJobsTable.setSortable(false);
    cronJobsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    cronJobsTable.getColumnModel().getColumn(0).setResizable(false);
    cronJobsTable.getColumnModel().getColumn(0).setCellEditor(new CronTableCellEditor(true));
    cronJobsTable.getColumnModel().getColumn(1).setResizable(false);
    cronJobsTable.getColumnModel().getColumn(1).setCellEditor(new CronTableCellEditor(true));

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        Highlighter highlighter = HighlighterFactory.createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR,
                UIConstants.BACKGROUND_COLOR);
        cronJobsTable.setHighlighters(highlighter);
    }

    HighlightPredicate errorHighlighterPredicate = new HighlightPredicate() {
        public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
            if (adapter.column == cronJobsTable.getColumnViewIndex("Expression")) {
                String cronExpression = (String) cronJobsTable.getValueAt(adapter.row, adapter.column);

                if (invalidExpressions.contains(cronExpression)) {
                    return true;
                }
            }
            return false;
        }
    };
    errorHighlighter = new ColorHighlighter(errorHighlighterPredicate, Color.PINK, Color.BLACK, Color.PINK,
            Color.BLACK);

    //@formatter:off
    String tooltip = "<html><head><style>td {text-align:center;}</style></head>"
            + "Cron expressions must be in Quartz format with at least 6 fields.<br/>" + "<br/>Format:"
            + "<table>" + "<tr><td>Field</td><td>Required</td><td>Values</td><td>Special Characters</td></tr>"
            + "<tr><td>Seconds</td><td>YES</td><td>0-59</td><td>, - * /</td></tr>"
            + "<tr><td>Minutes</td><td>YES</td><td>0-59</td><td>, - * /</td></tr>"
            + "<tr><td>Hours</td><td>YES</td><td>0-23</td><td>, - * /</td></tr>"
            + "<tr><td>Day of Month</td><td>YES</td><td>1-31</td><td>, - * ? / L W</td></tr>"
            + "<tr><td>Month</td><td>YES</td><td>1-12 or JAN-DEC</td><td>, - * /</td></tr>"
            + "<tr><td>Day of Week</td><td>YES</td><td>1-7 or SUN-SAT</td><td>, - * ? / L #</td></tr>"
            + "<tr><td>Year</td><td>NO</td><td>empty, 1970-2099</td><td>, - * /</td></tr>" + "</table>"
            + "<br/>Special Characters:" + "<br/> &nbsp <b>*</b> : all values"
            + "<br/> &nbsp <b>?</b> : no specific value" + "<br/> &nbsp <b>-</b> : used to specify ranges"
            + "<br/> &nbsp <b>,</b> : used to specify list of values"
            + "<br/> &nbsp <b>/</b> : used to specify increments"
            + "<br/> &nbsp <b>L</b> : used to specify the last of"
            + "<br/> &nbsp <b>W</b> : used to specify the nearest weekday"
            + "<br/> &nbsp <b>#</b> : used to specify the nth day of the month"
            + "<br/><br/>Example: 0 */5 8-17 * * ? means to fire every 5 minutes starting at 8am<br/>and ending at 5pm everyday"
            + "<br/><br/><b>Note:</b> Support for specifying both a day-of-week and day-of-month<br/>is not yet supported. A ? must be used in one of these fields.</html>";
    //@formatter:on
    cronJobsTable.setToolTipText(tooltip);
    cronJobsTable.getTableHeader().setToolTipText(tooltip);

    cronScrollPane = new JScrollPane();
    cronScrollPane.getViewport().add(cronJobsTable);

    addJobButton = new JButton("Add");
    addJobButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            ((DefaultTableModel) cronJobsTable.getModel()).addRow(new Vector<String>());

            int rowSelectionNumber = cronJobsTable.getRowCount() - 1;
            cronJobsTable.setRowSelectionInterval(rowSelectionNumber, rowSelectionNumber);
            PlatformUI.MIRTH_FRAME.setSaveEnabled(true);

            Boolean enabled = deleteJobButton.isEnabled();
            if (!enabled) {
                deleteJobButton.setEnabled(true);
            }
            updateNextFireTime();
        }
    });

    deleteJobButton = new JButton("Delete");
    deleteJobButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            int rowSelectionNumber = cronJobsTable.getSelectedRow();

            if (rowSelectionNumber > -1) {
                DefaultTableModel model = (DefaultTableModel) cronJobsTable.getModel();
                model.removeRow(rowSelectionNumber);

                rowSelectionNumber--;
                if (rowSelectionNumber > -1) {
                    cronJobsTable.setRowSelectionInterval(rowSelectionNumber, rowSelectionNumber);
                } else if (cronJobsTable.getRowCount() > 0) {
                    cronJobsTable.setRowSelectionInterval(0, 0);
                }

                if (cronJobsTable.getRowCount() == 0) {
                    deleteJobButton.setEnabled(false);
                }
            }

            updateNextFireTime();
            PlatformUI.MIRTH_FRAME.setSaveEnabled(true);
        }
    });
    deleteJobButton.setEnabled(false);

    advancedSettingsButton = new JButton(new ImageIcon(Frame.class.getResource("images/wrench.png")));
    advancedSettingsButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            lastSelectedPollingType = StringUtils.isBlank(lastSelectedPollingType) ? "Interval"
                    : lastSelectedPollingType;
            new AdvancedPollingSettingsDialog(lastSelectedPollingType, cachedAdvancedConnectorProperties,
                    channelContext);
            updateNextFireTime();
        }
    });

    timeSettingsLabel = new JLabel("Interval:");
    timeSettingsLabel.setBackground(UIConstants.BACKGROUND_COLOR);

    scheduleSettingsPanel = new JPanel();
    scheduleSettingsPanel.setBackground(UIConstants.BACKGROUND_COLOR);

    if (!channelContext) {
        // @formatter:off
        scheduleTypeComboBox.setToolTipText("<html>Select the pruning schedule type.<br>"
                + "Select \"Interval\" to prune each n units of time.<br>"
                + "Select \"Time\" to prune once a day at the specified time.<br>"
                + "Select \"Cron\" to prune at the specified cron expression(s).</html>");
        // @formatter:on 
        pollingFrequencyField.setToolTipText(
                "<html>The specified repeating time interval.<br/>Units must be between 1 and 24 hours of time<br/>when converted to milliseconds.</html>");
    }
}

From source file:mil.tatrc.physiology.utilities.csv.plots.MultiPlotter.java

protected void formatMultiPlot(PlotJob job, JFreeChart chart, XYSeriesCollection dataSet1,
        XYSeriesCollection dataSet2) {//from   www  .  j  av  a  2  s.  co m
    Color[] blueColors = { Color.blue, Color.cyan, new Color(0, 160, 255), new Color(0, 100, 255),
            new Color(0, 160, 255), new Color(14, 0, 145), new Color(70, 105, 150) };
    Color[] redColors = { Color.red, Color.magenta, new Color(255, 0, 100), new Color(255, 0, 160), Color.pink,
            new Color(145, 0, 0), new Color(132, 58, 58) };
    Color[] variedColors = { Color.red, Color.blue, Color.green, Color.orange, Color.magenta, Color.cyan,
            Color.gray, new Color(255, 165, 0), new Color(42, 183, 136), new Color(87, 158, 186) };
    XYPlot plot = (XYPlot) chart.getPlot();
    XYLineAndShapeRenderer renderer1 = (XYLineAndShapeRenderer) plot.getRenderer();
    BasicStroke wideLine = new BasicStroke(2.0f);

    //For Scientific notation
    NumberFormat formatter = new DecimalFormat("0.######E0");

    for (int i = 0; i < plot.getDomainAxisCount(); i++) {
        plot.getDomainAxis(i).setLabelFont(new Font("SansSerif", Font.PLAIN, job.fontSize));
        plot.getDomainAxis(i).setTickLabelFont(new Font("SansSerif", Font.PLAIN, 15));
        plot.getDomainAxis(i).setLabelPaint(job.bgColor == Color.red ? Color.white : Color.black);
        plot.getDomainAxis(i).setTickLabelPaint(job.bgColor == Color.red ? Color.white : Color.black);
    }
    for (int i = 0; i < plot.getRangeAxisCount(); i++) {
        plot.getRangeAxis(i).setLabelFont(new Font("SansSerif", Font.PLAIN, job.fontSize));
        plot.getRangeAxis(i).setTickLabelFont(new Font("SansSerif", Font.PLAIN, 15));
        plot.getRangeAxis(i).setLabelPaint(job.bgColor == Color.red ? Color.white : Color.black);
        plot.getRangeAxis(i).setTickLabelPaint(job.bgColor == Color.red ? Color.white : Color.black);
        NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(i);
        rangeAxis.setNumberFormatOverride(formatter);
    }

    //White background outside of plottable area
    chart.setBackgroundPaint(job.bgColor);

    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.black);
    plot.setRangeGridlinePaint(Color.black);

    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    chart.getLegend().setItemFont(new Font("SansSerif", Font.PLAIN, 15));
    chart.getTitle().setFont(new Font("SansSerif", Font.PLAIN, job.fontSize));
    chart.getTitle().setPaint(job.bgColor == Color.red ? Color.white : Color.black);

    //If there is only one Y axis, we just need to color the data series differently
    if (job.Y2headers == null || job.Y2headers.isEmpty()) {
        for (int i = 0, cIndex = 0; i < dataSet1.getSeriesCount(); i++, cIndex++) {
            renderer1.setSeriesStroke(i, wideLine);
            renderer1.setBaseShapesVisible(false);
            if (cIndex > 9)
                cIndex = 0;
            renderer1.setSeriesFillPaint(i, variedColors[cIndex]);
            renderer1.setSeriesPaint(i, variedColors[cIndex]);
        }
    }
    //If there are 2 Y axes, we should color the axes to correspond with the data so it isn't (as) confusing
    else {
        StandardXYItemRenderer renderer2 = new StandardXYItemRenderer();
        plot.setRenderer(1, renderer2);

        for (int i = 0, cIndex = 0; i < dataSet1.getSeriesCount(); i++, cIndex++) {
            renderer1.setSeriesStroke(i, wideLine);
            renderer1.setBaseShapesVisible(false);
            if (cIndex > 6)
                cIndex = 0;
            renderer1.setSeriesFillPaint(i, redColors[cIndex]);
            renderer1.setSeriesPaint(i, redColors[cIndex]);
        }
        for (int i = 0, cIndex = 0; i < dataSet2.getSeriesCount(); i++, cIndex++) {
            renderer2.setSeriesStroke(i, wideLine);
            renderer2.setBaseShapesVisible(false);
            if (cIndex > 6)
                cIndex = 0;
            renderer2.setSeriesFillPaint(i, blueColors[cIndex]);
            renderer2.setSeriesPaint(i, blueColors[cIndex]);
        }
        plot.getRangeAxis(0).setLabelPaint(redColors[0]);
        plot.getRangeAxis(0).setTickLabelPaint(redColors[0]);
        plot.getRangeAxis(1).setLabelPaint(blueColors[0]);
        plot.getRangeAxis(1).setTickLabelPaint(blueColors[0]);
    }
}

From source file:org.tsho.dmc2.core.chart.DmcLyapunovPlot.java

public LegendItemCollection getLegendItems() {
    if (type != AREA)
        return null;

    Stroke stroke = new BasicStroke(1.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL);
    Shape shape = new Rectangle2D.Double(-3, -3, 6, 6);

    LegendItemCollection legendItems = new LegendItemCollection();
    legendItems.add(new LegendItem("both zero", "", shape, true, Color.black, stroke, Color.yellow, stroke));

    legendItems.add(new LegendItem("zero, positive", "", shape, true, Color.red, stroke, Color.yellow, stroke));

    legendItems//from ww  w  .  jav a 2  s .c  om
            .add(new LegendItem("zero, negative", "", shape, true, Color.blue, stroke, Color.yellow, stroke));

    legendItems.add(
            new LegendItem("positive, negative", "", shape, true, Color.green, stroke, Color.yellow, stroke));

    legendItems
            .add(new LegendItem("both positive", "", shape, true, Color.orange, stroke, Color.yellow, stroke));

    legendItems.add(new LegendItem("both negative", "", shape, true, Color.pink, stroke, Color.yellow, stroke));

    return legendItems;
}

From source file:view.statistics.RequestStatsAndPrediction.java

private void predictButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_predictButtonActionPerformed
    int year = yearChooser.getYear();
    int month = monthChooser.getMonth() + 1;

    int currentYear = Calendar.getInstance().get(Calendar.YEAR);
    int currentMonth = Calendar.getInstance().get(Calendar.MONTH) + 1;

    int data[][] = null;

    try {/*  w  w w.  j  ava 2  s . com*/
        data = sdcontroller.getYearlyRequestCountsOf(month);
    } catch (ClassNotFoundException ex) {
    } catch (SQLException ex) {
    }

    if (year >= currentYear && month >= currentMonth) {

        try {
            predictText.setText(Predictions.getPredictedRequestsOf(year, month) + "");
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(RequestStatsAndPrediction.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(RequestStatsAndPrediction.class.getName()).log(Level.SEVERE, null, ex);
        }
    } else {
        JOptionPane.showMessageDialog(this,
                "Predictions available only for future months. Only the graph will be drawn", "Error",
                JOptionPane.ERROR_MESSAGE);
        predictText.setText("Invalid input!");
    }

    //if (data != null) {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    if (data != null) {
        for (int i = 0; i < data[0].length; i++) {
            dataset.setValue(data[1][i], "Year", data[0][i] + "");
        }
    }

    JFreeChart chart = ChartFactory.createLineChart3D(
            "Yearly Blood Request Count For The Month of " + getMontName(month + ""), "Year", "Request Count",
            dataset, PlotOrientation.VERTICAL, false, true, false);
    chart.setBackgroundPaint(Color.PINK);
    chart.getTitle().setPaint(Color.RED);
    CategoryPlot p = chart.getCategoryPlot();
    p.setRangeGridlinePaint(Color.BLUE);

    ChartPanel panel = new ChartPanel(chart);
    panel.setPreferredSize(new java.awt.Dimension(200, 350));
    chartAreaPanel.setLayout(new GridLayout());
    chartAreaPanel.removeAll();
    chartAreaPanel.revalidate();
    chartAreaPanel.add(panel);
    chartAreaPanel.repaint();

    this.repaint();

    //}
}

From source file:jboost.visualization.HistogramFrame.java

private JFreeChart createHistogramChart() {

    XYBarRenderer renderer1 = new XYBarRenderer();
    renderer1.setSeriesPaint(0, Color.cyan);
    renderer1.setSeriesPaint(1, Color.pink);

    XYPlot histPlot = new XYPlot(histogramDataset, null, new NumberAxis("count"), renderer1);

    XYBarRenderer renderer2 = new XYBarRenderer();
    renderer2.setSeriesPaint(0, Color.green);
    renderer2.setSeriesPaint(1, Color.orange);
    renderer2.setUseYInterval(true);//w w w.  j  av a 2  s. c  o m

    // weight and potential
    if (infoParser.isRobustBoost || infoParser.isAdaBoost || infoParser.isLogLossBoost) {
        StandardXYItemRenderer renderer3 = new StandardXYItemRenderer();
        renderer3.setSeriesPaint(0, Color.blue);
        renderer3.setSeriesPaint(1, Color.red);
        renderer3.setBaseStroke(new BasicStroke(2));

        StandardXYItemRenderer renderer4 = new StandardXYItemRenderer();
        renderer4.setSeriesPaint(0, Color.blue);
        renderer4.setSeriesPaint(1, Color.red);
        renderer4.setBaseStroke(
                new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 2, new float[] { 2 }, 0));

        histPlot.setDataset(1, weightDataset);
        histPlot.setRenderer(1, renderer3);

        histPlot.setDataset(2, potentialDataset);
        histPlot.setRenderer(2, renderer4);

        histPlot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    }

    XYPlot fluctPlot = new XYPlot(fluctDataset, null, new NumberAxis("bin"), renderer2);

    double initialLocation = (upper_limit + lower_limit) / 2.0;
    histMarker = new IntervalMarker(initialLocation, initialLocation);
    histPlot.addDomainMarker(histMarker, Layer.BACKGROUND);
    fluctPlot.addDomainMarker(histMarker, Layer.BACKGROUND);

    // plot.setBackgroundPaint(Color.lightGray);
    // plot.setDomainGridlinePaint(Color.white);
    // plot.setRangeGridlinePaint(Color.white);

    CombinedDomainXYPlot combinedPlot = new CombinedDomainXYPlot(new NumberAxis("score"));
    combinedPlot.setGap(10.0);

    // add the subplots...
    ValueAxis axis = new NumberAxis();
    axis.setRange(rawData.getMinRange(iter), rawData.getMaxRange(iter));
    combinedPlot.add(histPlot, 3);
    combinedPlot.add(fluctPlot, 1);
    combinedPlot.setOrientation(PlotOrientation.VERTICAL);
    combinedPlot.setDomainAxis(axis);

    JFreeChart chart = new JFreeChart("Histogram", JFreeChart.DEFAULT_TITLE_FONT, combinedPlot, false // legend
    );

    return chart;
}

From source file:edu.unibonn.kmeans.mapreduce.plotting.TimeSeriesPlotter_KMeans.java

private Paint getColor(int color_number) {
    Color curr_color = null;/*from ww w .j ava  2 s .c om*/

    switch (color_number) {
    case 0:
        curr_color = Color.BLUE;
        break;
    case 1:
        curr_color = Color.GREEN;
        break;
    case 2:
        curr_color = Color.RED;
        break;
    case 3:
        curr_color = Color.PINK;
        break;
    case 4:
        curr_color = Color.MAGENTA;
        break;
    case 5:
        curr_color = Color.CYAN;
        break;
    case 6:
        curr_color = Color.DARK_GRAY;
        break;
    case 7:
        curr_color = Color.LIGHT_GRAY;
        break;
    case 8:
        curr_color = Color.YELLOW;
        break;
    case 9:
        curr_color = Color.ORANGE;
        break;
    case 10:
        curr_color = Color.BLACK;
        break;
    //           case 11: curr_color = Color.YELLOW;
    //                    break;
    //           case 12: curr_color = Color.BLACK;
    //                    break;
    //           case 13: curr_color = Color.BLACK;
    //                  break;
    //           case 14: curr_color = Color.BLACK;
    //                  break;
    //           case 15: curr_color = Color.BLACK;
    //                break;
    //           case 16: curr_color = Color.BLACK;
    //                break;
    //           case 17: curr_color = Color.BLACK;
    //                break;
    //           case 18: curr_color = Color.BLACK;
    //                break;
    //           case 20: curr_color = Color.BLACK;
    //                break;
    //           case 21: curr_color = Color.BLACK;
    //                break;
    //           case 22: curr_color = Color.BLACK;
    //                break;
    //           case 23: curr_color = Color.BLACK;
    //                break;
    default:
        curr_color = Color.WHITE;
        break;
    }

    return curr_color;
}

From source file:org.tellervo.desktop.tridasv2.ui.ComponentViewer.java

private void setupTreeGUI() {
    //create a graph
    Graph<String, String> ig = Graphs
            .<String, String>synchronizedDirectedGraph(new DirectedSparseMultigraph<String, String>());

    ObservableGraph<String, String> og = new ObservableGraph<String, String>(ig);
    og.addGraphEventListener(new GraphEventListener<String, String>() {

        public void handleGraphEvent(GraphEvent<String, String> evt) {
            System.err.println("got " + evt);

        }//from  w w  w  .jav  a  2  s.c  om
    });
    this.g = og;
    //create a graphdraw
    layout = new FRLayout<String, String>(g);
    //layout = new ISOMLayout<String, String>(g);
    //layout = new KKLayout<String, String>(g);
    //layout = new CircleLayout<String, String>(g);

    vv = new VisualizationViewer<String, String>(layout, null);

    //tree2Panel.putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);

    tree2Panel.setLayout(new BorderLayout());
    tree2Panel.setBackground(java.awt.Color.lightGray);
    tree2Panel.setFont(new Font("Serif", Font.PLAIN, 12));

    vv.getModel().getRelaxer().setSleepTime(500);
    final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse<Number, Number>();

    vv.setGraphMouse(graphMouse);

    vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR);
    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
    vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller());

    Transformer<String, Paint> vertexColor = new Transformer<String, Paint>() {
        public Paint transform(String i) {

            if (i.equals(ComponentTreeCellRenderer.getFullTitle(sample, false))) {
                return Color.ORANGE;
            } else {
                return Color.PINK;
            }
        }
    };

    Transformer<String, Paint> edgeColor = new Transformer<String, Paint>() {
        public Paint transform(String i) {
            return Color.WHITE;
        }
    };

    Transformer<String, Shape> vertexShape = new Transformer<String, Shape>() {
        public Shape transform(String i) {

            if (i.equals(ComponentTreeCellRenderer.getFullTitle(sample, false))) {
                return new Rectangle(-150, -20, 300, 40);

            } else {
                return new Rectangle(-150, -10, 300, 20);
            }
        }
    };

    vv.getRenderContext().setVertexFillPaintTransformer(vertexColor);
    vv.getRenderContext().setEdgeDrawPaintTransformer(edgeColor);
    vv.getRenderContext().setVertexShapeTransformer(vertexShape);
    ;

    vv.setForeground(Color.BLACK);
    tree2Panel.add(vv, BorderLayout.CENTER);

    JComboBox modeBox = graphMouse.getModeComboBox();

    modeBox.setRenderer(new JUNGModeRenderer());

    modeBox.addItemListener(graphMouse.getModeListener());
    graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING);

    final ScalingControl scaler = new CrossoverScalingControl();

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }
    });

    JPanel scaleGrid = new JPanel(new GridLayout(1, 0));
    scaleGrid.setBorder(BorderFactory.createTitledBorder("Zoom"));

    JPanel controls = new JPanel();
    scaleGrid.add(plus);
    scaleGrid.add(minus);
    controls.add(scaleGrid);
    controls.add(modeBox);

    tree2Panel.add(controls, BorderLayout.NORTH);

}

From source file:cs.cirg.cida.CIDAView.java

@Action
public void plotGraph() {
    lineSeriesComboBox.removeAllItems();
    int numSelectedColumns = userSelectedColumns.size();
    int numSelectedRows = userSelectedRows.size();
    if (numSelectedColumns == 0) {
        return;/*from w  w  w  .j  a  v  a2  s  .  co  m*/
    }
    StandardDataTable<Numeric> data = (StandardDataTable<Numeric>) ((IOBridgeTableModel) analysisTable
            .getModel()).getDataTable();
    List<Numeric> iterations = data.getColumn(0);

    XYSeriesCollection xySeriesCollection = new XYSeriesCollection();

    for (int i = 0; i < numSelectedColumns; i++) {
        int selectedColumnIndex = userSelectedColumns.get(i);
        List<Numeric> selectedColumn = data.getColumn(selectedColumnIndex);

        XYSeries series = new XYSeries(data.getColumnName(selectedColumnIndex));

        for (int k = 0; k < numSelectedRows; k++) {
            int selectedRowIndex = userSelectedRows.get(k);
            series.add(iterations.get(selectedRowIndex).getReal(),
                    selectedColumn.get(selectedRowIndex).getReal());
        }
        xySeriesCollection.addSeries(series);
        lineSeriesComboBox.addItem(new SeriesPair(i, (String) series.getKey()));
    }

    String chartName = experimentController.getAnalysisName();
    if (chartName.compareTo("") == 0) {
        chartName = CIDAConstants.DEFAULT_CHART_NAME;
    }
    JFreeChart chart = ChartFactory.createXYLineChart(chartName, // Title
            CIDAConstants.CHART_ITERATIONS_LABEL, // X-Axis label
            CIDAConstants.CHART_VALUE_LABEL, // Y-Axis label
            xySeriesCollection, // Dataset
            PlotOrientation.VERTICAL, true, // Show legend,
            false, //tooltips
            false //urls
    );
    chart.setAntiAlias(true);
    chart.setAntiAlias(true);
    XYPlot plot = (XYPlot) chart.getPlot();
    Paint[] paints = new Paint[7];
    paints[0] = Color.RED;
    paints[1] = Color.BLUE;
    paints[2] = new Color(0.08f, 0.5f, 0.04f);
    paints[3] = new Color(1.0f, 0.37f, 0.0f);
    paints[4] = new Color(0.38f, 0.07f, 0.42f);
    paints[5] = Color.CYAN;
    paints[6] = Color.PINK;
    plot.setDrawingSupplier(
            new DefaultDrawingSupplier(paints, paints, DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
                    DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
                    DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));
    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.GRAY);
    plot.setRangeGridlinePaint(Color.GRAY);

    IntervalXYRenderer renderer = new IntervalXYRenderer(true, false);
    plot.setRenderer(renderer);
    lineTickIntervalInput.setText(Integer.toString(renderer.getLineTickInterval()));

    ((ChartPanel) chartPanel).setChart(chart);
}

From source file:op.care.med.inventory.DlgNewStocks.java

/**
 * This method is called from within the constructor to
 * initialize the form.//from ww  w .  j  av a 2s. c  o m
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the PrinterForm Editor.
 */
// <editor-fold defaultstate="collapsed" desc=" Erzeugter Quelltext ">//GEN-BEGIN:initComponents
private void initComponents() {
    mainPane = new JPanel();
    lblPZN = new JLabel();
    panel2 = new JPanel();
    txtMedSuche = new JXSearchField();
    hSpacer1 = new JPanel(null);
    btnMed = new JButton();
    lblProd = new JLabel();
    cmbMProdukt = new JComboBox<>();
    lblInventory = new JLabel();
    lblResident = new JLabel();
    txtBWSuche = new JTextField();
    lblAmount = new JLabel();
    lblPack = new JLabel();
    cmbPackung = new JComboBox<>();
    lblExpires = new JLabel();
    txtExpires = new JTextField();
    panel3 = new JPanel();
    lblWeightControl = new JLabel();
    txtWeightControl = new JTextField();
    lblRemark = new JLabel();
    txtBemerkung = new JTextField();
    btnPrint = new JToggleButton();
    panel1 = new JPanel();
    btnClose = new JButton();
    btnApply = new JButton();

    //======== this ========
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("Medikamente einbuchen");
    setMinimumSize(new Dimension(640, 300));
    Container contentPane = getContentPane();
    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.PAGE_AXIS));

    //======== mainPane ========
    {
        mainPane.setLayout(new FormLayout(
                "14dlu, $lcgap, default, $lcgap, 39dlu:grow, $lcgap, default:grow, $lcgap, 14dlu",
                "14dlu, 2*($lgap, fill:17dlu), $lgap, fill:default, $lgap, 17dlu, 4*($lgap, fill:17dlu), 10dlu, fill:default, $lgap, 14dlu"));

        //---- lblPZN ----
        lblPZN.setText("PZN oder Suchbegriff");
        lblPZN.setFont(new Font("Arial", Font.PLAIN, 14));
        mainPane.add(lblPZN, CC.xy(3, 3));

        //======== panel2 ========
        {
            panel2.setLayout(new BoxLayout(panel2, BoxLayout.LINE_AXIS));

            //---- txtMedSuche ----
            txtMedSuche.setFont(new Font("Arial", Font.PLAIN, 14));
            txtMedSuche.addActionListener(e -> txtMedSucheActionPerformed(e));
            panel2.add(txtMedSuche);
            panel2.add(hSpacer1);

            //---- btnMed ----
            btnMed.setBackground(Color.white);
            btnMed.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png")));
            btnMed.setToolTipText("Medikamente bearbeiten");
            btnMed.setBorder(null);
            btnMed.setSelectedIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png")));
            btnMed.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnMed.addActionListener(e -> btnMedActionPerformed(e));
            panel2.add(btnMed);
        }
        mainPane.add(panel2, CC.xywh(5, 3, 4, 1));

        //---- lblProd ----
        lblProd.setText("Produkt");
        lblProd.setFont(new Font("Arial", Font.PLAIN, 14));
        mainPane.add(lblProd, CC.xy(3, 5));

        //---- cmbMProdukt ----
        cmbMProdukt.setModel(new DefaultComboBoxModel<>(new String[] {

        }));
        cmbMProdukt.setFont(new Font("Arial", Font.PLAIN, 14));
        cmbMProdukt.addItemListener(e -> cmbMProduktItemStateChanged(e));
        mainPane.add(cmbMProdukt, CC.xywh(5, 5, 4, 1));

        //---- lblInventory ----
        lblInventory.setText("vorhandene Vorr\u00e4te");
        lblInventory.setFont(new Font("Arial", Font.PLAIN, 14));
        mainPane.add(lblInventory, CC.xy(3, 13));

        //---- lblResident ----
        lblResident.setText("Zuordnung zu Bewohner");
        lblResident.setFont(new Font("Arial", Font.PLAIN, 14));
        mainPane.add(lblResident, CC.xy(3, 17));

        //---- txtBWSuche ----
        txtBWSuche.setFont(new Font("Arial", Font.PLAIN, 14));
        txtBWSuche.addCaretListener(e -> txtBWSucheCaretUpdate(e));
        mainPane.add(txtBWSuche, CC.xy(5, 17));

        //---- lblAmount ----
        lblAmount.setText("Buchungsmenge");
        lblAmount.setFont(new Font("Arial", Font.PLAIN, 14));
        mainPane.add(lblAmount, CC.xy(3, 11));

        //---- lblPack ----
        lblPack.setText("Packung");
        lblPack.setFont(new Font("Arial", Font.PLAIN, 14));
        mainPane.add(lblPack, CC.xy(3, 7));

        //---- cmbPackung ----
        cmbPackung.setModel(new DefaultComboBoxModel<>(new String[] {

        }));
        cmbPackung.setFont(new Font("Arial", Font.PLAIN, 14));
        cmbPackung.addItemListener(e -> cmbPackungItemStateChanged(e));
        mainPane.add(cmbPackung, CC.xywh(5, 7, 4, 1));

        //---- lblExpires ----
        lblExpires.setText("expires");
        lblExpires.setFont(new Font("Arial", Font.PLAIN, 14));
        mainPane.add(lblExpires, CC.xy(3, 9));

        //---- txtExpires ----
        txtExpires.setFont(new Font("Arial", Font.PLAIN, 14));
        txtExpires.addFocusListener(new FocusAdapter() {
            @Override
            public void focusGained(FocusEvent e) {
                txtExpiresFocusGained(e);
            }

            @Override
            public void focusLost(FocusEvent e) {
                txtExpiresFocusLost(e);
            }
        });
        txtExpires.addActionListener(e -> txtExpiresActionPerformed(e));
        mainPane.add(txtExpires, CC.xywh(5, 9, 3, 1, CC.DEFAULT, CC.FILL));

        //======== panel3 ========
        {
            panel3.setLayout(new FormLayout("pref, $lcgap, default:grow", "fill:17dlu"));

            //---- lblWeightControl ----
            lblWeightControl.setText("weightcontrol");
            lblWeightControl.setFont(new Font("Arial", Font.PLAIN, 14));
            lblWeightControl.setBackground(Color.pink);
            panel3.add(lblWeightControl, CC.xy(1, 1));

            //---- txtWeightControl ----
            txtWeightControl.setFont(new Font("Arial", Font.PLAIN, 14));
            txtWeightControl.setBackground(Color.pink);
            txtWeightControl.addFocusListener(new FocusAdapter() {
                @Override
                public void focusGained(FocusEvent e) {
                    txtWeightControlFocusGained(e);
                }
            });
            txtWeightControl.addCaretListener(e -> txtWeightControlCaretUpdate(e));
            panel3.add(txtWeightControl, CC.xy(3, 1, CC.DEFAULT, CC.FILL));
        }
        mainPane.add(panel3, CC.xy(7, 11));

        //---- lblRemark ----
        lblRemark.setText("Bemerkung");
        lblRemark.setFont(new Font("Arial", Font.PLAIN, 14));
        mainPane.add(lblRemark, CC.xy(3, 15));

        //---- txtBemerkung ----
        txtBemerkung.setFont(new Font("Arial", Font.PLAIN, 14));
        txtBemerkung.addCaretListener(e -> txtBemerkungCaretUpdate(e));
        mainPane.add(txtBemerkung, CC.xywh(5, 15, 4, 1));

        //---- btnPrint ----
        btnPrint.setSelectedIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/printer-on.png")));
        btnPrint.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/printer-off.png")));
        btnPrint.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        btnPrint.setEnabled(false);
        btnPrint.addItemListener(e -> btnPrintItemStateChanged(e));
        mainPane.add(btnPrint, CC.xy(3, 19, CC.RIGHT, CC.DEFAULT));

        //======== panel1 ========
        {
            panel1.setLayout(new BoxLayout(panel1, BoxLayout.X_AXIS));

            //---- btnClose ----
            btnClose.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/cancel.png")));
            btnClose.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnClose.addActionListener(e -> btnCloseActionPerformed(e));
            panel1.add(btnClose);

            //---- btnApply ----
            btnApply.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/apply.png")));
            btnApply.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnApply.addActionListener(e -> btnApplyActionPerformed(e));
            panel1.add(btnApply);
        }
        mainPane.add(panel1, CC.xywh(7, 19, 2, 1, CC.RIGHT, CC.DEFAULT));
    }
    contentPane.add(mainPane);
    pack();
    setLocationRelativeTo(getOwner());
}

From source file:courseapplication.CourseApplication1.java

private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
    double[] xValues = data.getxValues();
    double[] yValues = data.getyValues();
    double step = 0.0001;
    double[] xValuesForGraph = prepareArray(xValues, step);
    double[] polinom = new double[xValuesForGraph.length];
    double[] lagr = new double[xValuesForGraph.length];
    XYSeries seriesFunction = new XYSeries("Function values");
    XYSeries seriesLagranje = new XYSeries("Lagranje values");
    XYSeries seriesPolinom = new XYSeries("Polinom values");
    double[] yValuesForGraph = new double[xValuesForGraph.length];

    for (int i = 0; i < yValuesForGraph.length; i++) {
        yValuesForGraph[i] = data.function(function, (xValuesForGraph[i]));
    }/*w w w  .  j a  v a2s .  co  m*/

    for (int i = 0; i < yValuesForGraph.length; i++) {
        polinom[i] = interpolation.polinomInterpolation(polinomResult, xValuesForGraph[i]);
        lagr[i] = interpolation.lagranjeInterpolation(xValues, yValues, xValuesForGraph[i]);
    }

    for (int i = 0; i < xValuesForGraph.length; i++) {
        seriesFunction.add(xValuesForGraph[i], yValuesForGraph[i]);
        seriesLagranje.add(xValuesForGraph[i], lagr[i]);
        seriesPolinom.add(xValuesForGraph[i], polinom[i]);

    }

    XYSeriesCollection data = new XYSeriesCollection();
    data.addSeries(seriesFunction);
    data.addSeries(seriesLagranje);
    data.addSeries(seriesPolinom);

    // XYDataset data = new XYSeriesCollection(seriesFunction);

    JFreeChart chart = ChartFactory.createXYLineChart("Function values and approximation functions", "X",
            "F(x)", data, PlotOrientation.VERTICAL, true, true, true);
    JFrame frameForGraphic = new JFrame("Graphic");
    XYPlot plot = chart.getXYPlot();
    XYItemRenderer renderer = plot.getRenderer();
    renderer.setSeriesPaint(0, Color.GREEN);
    renderer.setSeriesPaint(1, Color.BLUE);
    renderer.setSeriesPaint(2, Color.PINK);
    frameForGraphic.getContentPane().add(new ChartPanel(chart));
    frameForGraphic.show();
    frameForGraphic.setPreferredSize(new Dimension(800, 600));
    frameForGraphic.setLocationRelativeTo(null);
    frameForGraphic.pack();
}