Search in sources :

Example 1 with JDateField

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

the class ProfitLossTXT method getDates.

private LocalDate[] getDates() {
    final LocalDate start = LocalDate.now().minusYears(1);
    final JDateField startField = new JDateField();
    final JDateField endField = new JDateField();
    startField.setValue(start);
    final FormLayout layout = new FormLayout("right:p, 4dlu, p:g", "");
    final DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.rowGroupingEnabled(true);
    builder.append(rb.getString("Label.StartDate"), startField);
    builder.append(rb.getString("Label.EndDate"), endField);
    builder.nextLine();
    builder.appendUnrelatedComponentsGapRow();
    builder.nextLine();
    final JPanel panel = builder.getPanel();
    int option = JOptionPane.showConfirmDialog(null, new Object[] { panel }, rb.getString("Message.StartEndDate"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
    if (option == JOptionPane.OK_OPTION) {
        return new LocalDate[] { startField.localDateValue(), endField.localDateValue() };
    }
    return null;
}
Also used : JDateField(jgnash.ui.components.JDateField) FormLayout(com.jgoodies.forms.layout.FormLayout) JPanel(javax.swing.JPanel) DefaultFormBuilder(com.jgoodies.forms.builder.DefaultFormBuilder) LocalDate(java.time.LocalDate)

Example 2 with JDateField

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

the class RecurringEntryDialog method createEntryPanel.

private JPanel createEntryPanel() {
    FormLayout layout = new FormLayout("right:p, 4dlu, 45dlu", "f:p, 3dlu, f:p");
    CellConstraints cc = new CellConstraints();
    JPanel p = new JPanel(layout);
    autoEnterCheckBox = new JCheckBox(rb.getString("Button.EnterDaysBefore"));
    daysBeforeField = new JIntegerField();
    lastOccurrenceField = new JDateField();
    p.add(autoEnterCheckBox, cc.xy(1, 1));
    p.add(daysBeforeField, cc.xy(3, 1));
    p.add(new JLabel(rb.getString("Label.LastOccurrence")), cc.xy(1, 3));
    p.add(lastOccurrenceField, cc.xy(3, 3));
    // clear the date
    lastOccurrenceField.setValue(null);
    lastOccurrenceField.setEditable(false);
    return p;
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) JCheckBox(javax.swing.JCheckBox) JIntegerField(jgnash.ui.components.JIntegerField) JDateField(jgnash.ui.components.JDateField) JPanel(javax.swing.JPanel) JLabel(javax.swing.JLabel) CellConstraints(com.jgoodies.forms.layout.CellConstraints)

Aggregations

FormLayout (com.jgoodies.forms.layout.FormLayout)2 JPanel (javax.swing.JPanel)2 JDateField (jgnash.ui.components.JDateField)2 DefaultFormBuilder (com.jgoodies.forms.builder.DefaultFormBuilder)1 CellConstraints (com.jgoodies.forms.layout.CellConstraints)1 LocalDate (java.time.LocalDate)1 JCheckBox (javax.swing.JCheckBox)1 JLabel (javax.swing.JLabel)1 JIntegerField (jgnash.ui.components.JIntegerField)1