Search in sources :

Example 1 with IndeterminateCheckBox

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

the class AbstractTransactionEntryPanel method init.

private void init() {
    amountField = new JFloatField(account.getCurrencyNode());
    accountPanel = new AccountExchangePanel(account.getCurrencyNode(), account, amountField);
    enterButton = new JButton(rb.getString("Button.Enter"));
    cancelButton = new JButton(rb.getString("Button.Clear"));
    memoField = AutoCompleteFactory.getMemoField();
    reconciledButton = new IndeterminateCheckBox(rb.getString("Button.Reconciled"));
    reconciledButton.setHorizontalTextPosition(SwingConstants.LEADING);
    reconciledButton.setMargin(new Insets(0, 0, 0, 0));
    /* Connect the buttons to the form */
    cancelButton.addActionListener(this);
    enterButton.addActionListener(this);
    /* Allows the user to submit the form from the keyboard when the enter button is selected */
    KeyAdapter enterKeyListener = new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ENTER) {
                enterAction();
            }
        }
    };
    enterButton.addKeyListener(enterKeyListener);
    amountField.addKeyListener(enterKeyListener);
    // focus will return to the first field
    setFocusCycleRoot(true);
}
Also used : KeyEvent(java.awt.event.KeyEvent) Insets(java.awt.Insets) JFloatField(jgnash.ui.components.JFloatField) KeyAdapter(java.awt.event.KeyAdapter) JButton(javax.swing.JButton) IndeterminateCheckBox(jgnash.ui.components.IndeterminateCheckBox)

Aggregations

Insets (java.awt.Insets)1 KeyAdapter (java.awt.event.KeyAdapter)1 KeyEvent (java.awt.event.KeyEvent)1 JButton (javax.swing.JButton)1 IndeterminateCheckBox (jgnash.ui.components.IndeterminateCheckBox)1 JFloatField (jgnash.ui.components.JFloatField)1