Search in sources :

Example 1 with SecurityComboBox

use of jgnash.ui.components.SecurityComboBox in project jgnash by ccavanaugh.

the class SecurityHighLowChart method createPanel.

private JPanel createPanel() {
    combo = new SecurityComboBox();
    // create an empty chart for panel construction
    chartPanel = new ChartPanel(new JFreeChart(new XYPlot()));
    FormLayout layout = new FormLayout("p, 4dlu:g", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.append(combo);
    builder.nextLine();
    builder.appendRelatedComponentsGapRow();
    builder.nextLine();
    builder.appendRow(RowSpec.decode("fill:p:g"));
    builder.append(chartPanel, 2);
    combo.addActionListener(e -> updateChart());
    return builder.getPanel();
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) ChartPanel(org.jfree.chart.ChartPanel) XYPlot(org.jfree.chart.plot.XYPlot) DefaultFormBuilder(com.jgoodies.forms.builder.DefaultFormBuilder) SecurityComboBox(jgnash.ui.components.SecurityComboBox) JFreeChart(org.jfree.chart.JFreeChart)

Example 2 with SecurityComboBox

use of jgnash.ui.components.SecurityComboBox in project jgnash by ccavanaugh.

the class SecuritiesHistoryDialog method initComponents.

private void initComponents() {
    dateField = new DatePanel();
    closeField = new JFloatField();
    lowField = new JFloatField();
    highField = new JFloatField();
    securityCombo = new SecurityComboBox();
    volumeField = new JIntegerField();
    updateButton = new JButton(rb.getString("Button.UpdateOnline"), IconUtils.getIcon("/jgnash/resource/applications-internet.png"));
    deleteButton = new JButton(rb.getString("Button.Delete"));
    clearButton = new JButton(rb.getString("Button.Clear"));
    applyButton = new JButton(rb.getString("Button.Add"));
    closeButton = new JButton(rb.getString("Button.Close"));
    model = new HistoryModel();
    table = new HistoryTable();
    table.setModel(model);
    table.setPreferredScrollableViewportSize(new Dimension(150, 120));
    table.setCellSelectionEnabled(false);
    table.setColumnSelectionAllowed(false);
    table.setRowSelectionAllowed(true);
    table.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    table.setRowSorter(new TableRowSorter<>(model));
    table.setFillsViewportHeight(true);
    // create an empty chart for panel construction
    chartPanel = new ChartPanel(new JFreeChart(new XYPlot()));
    chartPanel.setPreferredSize(new Dimension(150, 90));
    applyButton.addActionListener(this);
    clearButton.addActionListener(this);
    deleteButton.addActionListener(this);
    updateButton.addActionListener(this);
    securityCombo.addActionListener(this);
    closeButton.addActionListener(this);
}
Also used : JIntegerField(jgnash.ui.components.JIntegerField) ChartPanel(org.jfree.chart.ChartPanel) JFloatField(jgnash.ui.components.JFloatField) XYPlot(org.jfree.chart.plot.XYPlot) DatePanel(jgnash.ui.components.DatePanel) JButton(javax.swing.JButton) SecurityComboBox(jgnash.ui.components.SecurityComboBox) Dimension(java.awt.Dimension) JFreeChart(org.jfree.chart.JFreeChart)

Aggregations

SecurityComboBox (jgnash.ui.components.SecurityComboBox)2 ChartPanel (org.jfree.chart.ChartPanel)2 JFreeChart (org.jfree.chart.JFreeChart)2 XYPlot (org.jfree.chart.plot.XYPlot)2 DefaultFormBuilder (com.jgoodies.forms.builder.DefaultFormBuilder)1 FormLayout (com.jgoodies.forms.layout.FormLayout)1 Dimension (java.awt.Dimension)1 JButton (javax.swing.JButton)1 DatePanel (jgnash.ui.components.DatePanel)1 JFloatField (jgnash.ui.components.JFloatField)1 JIntegerField (jgnash.ui.components.JIntegerField)1