Example usage for javax.swing JSpinner setName

List of usage examples for javax.swing JSpinner setName

Introduction

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

Prototype

public void setName(String name) 

Source Link

Document

Sets the name of the component to the specified string.

Usage

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

protected void addDate(Date fecha, String title, boolean editable) {
    rows++;/*from  ww w . j  a  va2 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.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  w  w  w . j a va2s.  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());
}

From source file:Forms.FrmPrincipal.java

private void genCapasOcultas() {
    pnlCapas.removeAll();/*from   w w  w .  jav  a  2s . c o  m*/
    int n = Integer.parseInt(spIntermedias.getValue().toString()) + 2;
    for (int i = 0; i < n; i++) {
        JSpinner spinner = new JSpinner();
        spinner.setName("capa" + String.valueOf(i));
        spinner.setValue(100);
        spinner.setSize(70, 20);
        spinner.setVisible(false);
        spinner.setVisible(true);
        pnlCapas.add(spinner);
        if (i == 0) {
            spinner.setValue(matrizPatrones[0].length - 1);
            spinner.setEnabled(false);
        } else if (i == n - 1) {
            spinner.setValue(String.valueOf(matrizPatrones[0][matrizPatrones[0].length - 1]).length());
            spinner.setEnabled(false);
        }
    }
    pnlCapas.setVisible(false);
    pnlCapas.setVisible(true);
}