Example usage for javax.swing JSpinner setPreferredSize

List of usage examples for javax.swing JSpinner setPreferredSize

Introduction

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

Prototype

@BeanProperty(preferred = true, description = "The preferred size of the component.")
public void setPreferredSize(Dimension preferredSize) 

Source Link

Document

Sets the preferred size of this component.

Usage

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

protected void addDate(Date fecha, String title, boolean editable) {
    rows++;//ww  w  .  ja v  a2  s. c  o m
    // 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++;//from   ww w  .  j  a v  a2s .  com
    // 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());
}