Example usage for javax.swing JSpinner.DateEditor setEnabled

List of usage examples for javax.swing JSpinner.DateEditor setEnabled

Introduction

In this page you can find the example usage for javax.swing JSpinner.DateEditor setEnabled.

Prototype

@BeanProperty(expert = true, preferred = true, visualUpdate = true, description = "The enabled state of the component.")
public void setEnabled(boolean enabled) 

Source Link

Document

Sets whether or not this component is enabled.

Usage

From source file:es.emergya.ui.plugins.forms.FormGeneric.java

protected void addDate(Date fecha, String title, boolean editable) {
    rows++;//from   w  ww .  ja va 2s  .  c  om
    // TODO editable
    mid.add(new JLabel(i18n.getString(title), JLabel.RIGHT));
    JPanel panel = new JPanel();
    panel.setOpaque(false);
    JCalendarCombo calendar = new JCalendarCombo();
    calendar.setName(title);
    calendar.setEditable(editable);
    calendar.setPreferredSize(new Dimension(300, 30));
    calendar.setDate(fecha);
    panel.add(calendar);
    componentes.add(calendar);
    JSpinner res = new JSpinner(new SpinnerDateModel());
    res.setName(title);
    res.setPreferredSize(new Dimension(60, 30));
    res.setName(title);
    JSpinner.DateEditor startEditor = new JSpinner.DateEditor(res, "HH:mm:ss");
    startEditor.setEnabled(editable);
    res.setEditor(startEditor);
    if (fecha != null)
        res.setValue(fecha);
    componentes.add(res);
    panel.add(res);
    mid.add(panel);
    for (int i = 3; i < cols; i++)
        mid.add(Box.createHorizontalGlue());
}

From source file:es.emergya.ui.gis.popups.GenericDialog.java

protected void addDate(Date fecha, String title, boolean editable) {
    rows++;/*w w  w .  ja v a 2 s  .  co  m*/
    // TODO editable
    mid.add(new JLabel(i18n.getString(title), JLabel.RIGHT));
    JPanel panel = new JPanel();
    panel.setOpaque(false);
    JCalendarCombo calendar = new JCalendarCombo();
    calendar.setEditable(editable);
    calendar.setPreferredSize(new Dimension(300, 30));
    calendar.setDate(fecha);
    calendar.setName(title);
    componentes.add(calendar);
    panel.add(calendar);
    JSpinner res = new JSpinner(new SpinnerDateModel());
    res.setName(title);
    res.setPreferredSize(new Dimension(60, 30));
    JSpinner.DateEditor startEditor = new JSpinner.DateEditor(res, "HH:mm:ss");
    startEditor.setEnabled(editable);
    res.setEditor(startEditor);
    componentes.add(res);
    if (fecha != null)
        res.setValue(fecha);
    panel.add(res);
    mid.add(panel);
    for (int i = 3; i < cols; i++)
        mid.add(Box.createHorizontalGlue());
}