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());
}
});
}
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);
}
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);
}
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();
}
Aggregations