Search in sources :

Example 1 with CurrencyComboBox

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

the class DefaultCurrencyAction method actionPerformed.

@Override
public void actionPerformed(final ActionEvent e) {
    EventQueue.invokeLater(() -> {
        final ResourceBundle rb = ResourceUtils.getBundle();
        final CurrencyComboBox combo = new CurrencyComboBox();
        Object[] options = { rb.getString("Button.Ok"), rb.getString("Button.Cancel") };
        int result = JOptionPane.showOptionDialog(UIApplication.getFrame(), combo, rb.getString("Title.SelDefCurr"), JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, options[1]);
        if (result == JOptionPane.YES_OPTION) {
            final Engine engine = EngineFactory.getEngine(EngineFactory.DEFAULT);
            Objects.requireNonNull(engine);
            engine.setDefaultCurrency(combo.getSelectedNode());
            JOptionPane.showMessageDialog(UIApplication.getFrame(), rb.getString("Message.CurrChange") + " " + engine.getDefaultCurrency().getSymbol());
        }
    });
}
Also used : CurrencyComboBox(jgnash.ui.components.CurrencyComboBox) ResourceBundle(java.util.ResourceBundle) Engine(jgnash.engine.Engine)

Example 2 with CurrencyComboBox

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

the class CurrencyExchangeDialog method initComponents.

private void initComponents() {
    baseCurrencyCombo = new CurrencyComboBox();
    exchangeCurrencyCombo = new CurrencyComboBox();
    dateField = new DatePanel();
    baseCurrencyCombo.addActionListener(this);
    exchangeCurrencyCombo.addActionListener(this);
    model = new HistoryModel();
    table = new HistoryTable();
    table.setModel(model);
    table.setPreferredScrollableViewportSize(new java.awt.Dimension(150, 150));
    table.setCellSelectionEnabled(false);
    table.setColumnSelectionAllowed(false);
    table.setRowSelectionAllowed(true);
    table.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    table.setRowSorter(new TableRowSorter<>(model));
    table.setFillsViewportHeight(true);
    table.getSelectionModel().addListSelectionListener(this);
    closeButton = new JButton(rb.getString("Button.Close"));
    deleteButton = new JButton(rb.getString("Button.Delete"));
    clearButton = new JButton(rb.getString("Button.Clear"));
    addButton = new JButton(rb.getString("Button.Add"));
    updateButton = new JButton(rb.getString("Button.UpdateOnline"));
    updateButton.setIcon(IconUtils.getIcon("/jgnash/resource/applications-internet.png"));
    progressBar = new JProgressBar();
    stopButton = new JButton(rb.getString("Button.Stop"));
    stopButton.setIcon(IconUtils.getIcon("/jgnash/resource/process-stop.png"));
    stopButton.setEnabled(false);
    addButton.addActionListener(this);
    clearButton.addActionListener(this);
    closeButton.addActionListener(this);
    deleteButton.addActionListener(this);
    updateButton.addActionListener(this);
    stopButton.addActionListener(this);
    EventQueue.invokeLater(CurrencyExchangeDialog.this::updateModel);
}
Also used : DatePanel(jgnash.ui.components.DatePanel) CurrencyComboBox(jgnash.ui.components.CurrencyComboBox) JButton(javax.swing.JButton) JProgressBar(javax.swing.JProgressBar)

Example 3 with CurrencyComboBox

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

the class AccountPanel method initComponents.

private void initComponents() {
    accountNumberField = new JTextFieldEx();
    accountCodeField = new JIntegerField();
    nameField = new JTextFieldEx();
    bankIdField = new JTextFieldEx();
    nameField.setText(rb.getString("Word.Name"));
    descriptionField = new JTextFieldEx();
    descriptionField.setText(rb.getString("Word.Description"));
    currencyCombo = new CurrencyComboBox();
    securityButton = new JButton(rb.getString("Word.None"));
    // for preferred width so button does not force a wide layout
    securityButton.setPreferredSize(new Dimension(20, securityButton.getPreferredSize().height));
    accountTypeModel = new DefaultComboBoxModel<>(AccountType.values());
    accountTypeModel.removeElement(AccountType.ROOT);
    accountTypeCombo = new JComboBox<>(accountTypeModel);
    lockedCheckBox = new JCheckBox(rb.getString("Button.Locked"));
    placeholderCheckBox = new JCheckBox(rb.getString("Button.PlaceHolder"));
    hideCheckBox = new JCheckBox(rb.getString("Button.HideAccount"));
    excludeBudgetCheckBox = new JCheckBox(rb.getString("Button.ExcludeFromBudget"));
    parentButton = new JButton("Root");
    notesArea = new javax.swing.JTextArea();
    notesArea.setLineWrap(true);
    notesArea.setAutoscrolls(false);
    notesArea.setPreferredSize(new java.awt.Dimension(100, 80));
    accountTypeCombo.addActionListener(this);
    securityButton.addActionListener(this);
    parentButton.addActionListener(this);
}
Also used : JIntegerField(jgnash.ui.components.JIntegerField) JCheckBox(javax.swing.JCheckBox) Dimension(java.awt.Dimension) CurrencyComboBox(jgnash.ui.components.CurrencyComboBox) JButton(javax.swing.JButton) JTextFieldEx(jgnash.ui.components.JTextFieldEx) Dimension(java.awt.Dimension) JTextArea(javax.swing.JTextArea)

Example 4 with CurrencyComboBox

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

the class SecurityModifyPanel method initComponents.

private void initComponents() {
    securityList = new JList<>();
    securityList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    symbolField = new JTextFieldEx();
    descriptionField = new JTextFieldEx();
    scaleField = new JIntegerField();
    scaleField.setToolTipText(rb.getString("ToolTip.Scale"));
    isinField = new JTextFieldEx();
    isinField.setToolTipText(rb.getString("ToolTip.ISIN"));
    sourceComboBox = new QuoteSourceComboBox();
    currencyCombo = new CurrencyComboBox();
    currencyCombo.setSelectedNode(engine.getDefaultCurrency());
    newButton = new JButton(rb.getString("Button.New"));
    deleteButton = new JButton(rb.getString("Button.Delete"));
    cancelButton = new JButton(rb.getString("Button.Cancel"));
    applyButton = new JButton(rb.getString("Button.Apply"));
    applyButton.addActionListener(this);
    cancelButton.addActionListener(this);
    deleteButton.addActionListener(this);
    newButton.addActionListener(this);
    buildLists();
}
Also used : JIntegerField(jgnash.ui.components.JIntegerField) CurrencyComboBox(jgnash.ui.components.CurrencyComboBox) JButton(javax.swing.JButton) JTextFieldEx(jgnash.ui.components.JTextFieldEx) QuoteSourceComboBox(jgnash.ui.components.QuoteSourceComboBox)

Aggregations

CurrencyComboBox (jgnash.ui.components.CurrencyComboBox)4 JButton (javax.swing.JButton)3 JIntegerField (jgnash.ui.components.JIntegerField)2 JTextFieldEx (jgnash.ui.components.JTextFieldEx)2 Dimension (java.awt.Dimension)1 ResourceBundle (java.util.ResourceBundle)1 JCheckBox (javax.swing.JCheckBox)1 JProgressBar (javax.swing.JProgressBar)1 JTextArea (javax.swing.JTextArea)1 Engine (jgnash.engine.Engine)1 DatePanel (jgnash.ui.components.DatePanel)1 QuoteSourceComboBox (jgnash.ui.components.QuoteSourceComboBox)1