Search in sources :

Example 1 with Adjustable

use of net.sf.sdedit.ui.components.configuration.Adjustable in project abstools by abstools.

the class NumberConfigurator method initialize.

private void initialize() {
    setLayout(new BorderLayout());
    Adjustable adjustable = getProperty().getWriteMethod().getAnnotation(Adjustable.class);
    min = adjustable.min();
    max = adjustable.max();
    SpinnerNumberModel model = new SpinnerNumberModel(adjustable.min(), adjustable.min(), adjustable.max(), adjustable.step());
    spinner = new JSpinner(model);
    spinner.setPreferredSize(new Dimension(45, 1));
    spinner.addChangeListener(this);
    label = new JLabel(adjustable.info());
    label.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0));
    add(spinner, BorderLayout.WEST);
    add(label, BorderLayout.CENTER);
}
Also used : SpinnerNumberModel(javax.swing.SpinnerNumberModel) BorderLayout(java.awt.BorderLayout) JSpinner(javax.swing.JSpinner) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) Adjustable(net.sf.sdedit.ui.components.configuration.Adjustable)

Aggregations

BorderLayout (java.awt.BorderLayout)1 Dimension (java.awt.Dimension)1 JLabel (javax.swing.JLabel)1 JSpinner (javax.swing.JSpinner)1 SpinnerNumberModel (javax.swing.SpinnerNumberModel)1 Adjustable (net.sf.sdedit.ui.components.configuration.Adjustable)1