PageRenderTime 123ms CodeModel.GetById 41ms app.highlight 8ms RepoModel.GetById 72ms app.codeStats 0ms

/src/mpv5/ui/beans/LabeledSpinner.java

http://mp-rechnungs-und-kundenverwaltung.googlecode.com/
Java | 135 lines | 67 code | 27 blank | 41 comment | 0 complexity | e2c382eb639d036aa73b9860065be2f5 MD5 | raw file
  1
  2/*
  3 * LabeledTextField.java
  4 *
  5 * Created on 20.11.2008, 19:26:39
  6 */
  7package mpv5.ui.beans;
  8
  9import java.awt.Font;
 10import javax.swing.JSpinner;
 11
 12/**
 13 *
 14 *  
 15 */
 16public class LabeledSpinner extends javax.swing.JPanel {
 17
 18    private static final long serialVersionUID = 1L;
 19    private String _text;
 20    private String _label;
 21    private Class clazz;
 22    private LabeledDateChooser receiver;
 23
 24    /** Creates new form LabeledTextField */
 25    public LabeledSpinner() {
 26        initComponents();
 27
 28    }
 29
 30    public JSpinner getSpinner() {
 31        return jSpinner1;
 32    }
 33
 34
 35
 36
 37//    public void setLabelFont(Font font) {
 38//        setFont(font);
 39//
 40//    }
 41    /** This method is called from within the constructor to
 42     * initialize the form.
 43     * WARNING: Do NOT modify this code. The content of this method is
 44     * always regenerated by the Form Editor.
 45     */
 46    @SuppressWarnings("unchecked")
 47    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
 48    private void initComponents() {
 49
 50        jLabel1 = new javax.swing.JLabel();
 51        jSpinner1 = new javax.swing.JSpinner();
 52
 53        setOpaque(false);
 54        setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.LINE_AXIS));
 55
 56        jLabel1.setText("text");
 57        jLabel1.setMaximumSize(new java.awt.Dimension(333, 333));
 58        jLabel1.setPreferredSize(new java.awt.Dimension(100, 18));
 59        add(jLabel1);
 60
 61        jSpinner1.setFont(jSpinner1.getFont());
 62        jSpinner1.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1)));
 63        jSpinner1.setEditor(new javax.swing.JSpinner.NumberEditor(jSpinner1, ""));
 64        jSpinner1.setPreferredSize(new java.awt.Dimension(100, 20));
 65        jSpinner1.addChangeListener(new javax.swing.event.ChangeListener() {
 66            public void stateChanged(javax.swing.event.ChangeEvent evt) {
 67                jSpinner1StateChanged(evt);
 68            }
 69        });
 70        add(jSpinner1);
 71    }// </editor-fold>//GEN-END:initComponents
 72
 73    private void jSpinner1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jSpinner1StateChanged
 74       
 75    }//GEN-LAST:event_jSpinner1StateChanged
 76
 77    // Variables declaration - do not modify//GEN-BEGIN:variables
 78    private javax.swing.JLabel jLabel1;
 79    private javax.swing.JSpinner jSpinner1;
 80    // End of variables declaration//GEN-END:variables
 81
 82    /**
 83     * @return the _text
 84     */
 85    public Object get_Value() {
 86        return jSpinner1.getValue();
 87    }
 88
 89    /**
 90     * @param text the _text to set
 91     */
 92    public void set_Value(Object text) {
 93        this._text = String.valueOf(text);
 94        jSpinner1.setValue(text);
 95
 96    }
 97
 98    /**
 99     * @return the _label
100     */
101    public String get_Label() {
102        return jLabel1.getText();
103    }
104
105    /**
106     * @param label the _label to set
107     */
108    public void set_Label(String label) {
109        this._label = label;
110        jLabel1.setText(_label);
111        this.setToolTipText(_text);
112        jLabel1.setToolTipText(_text);
113    }
114
115    public void set_LabelFont(Font font) {
116//        if (font != null) {
117//            jLabel1.setFont(font);
118//        }
119    }
120
121    @Override
122    public void setEnabled(boolean enabled) {
123        jLabel1.setEnabled(enabled);
124        jSpinner1.setEnabled(enabled);
125    }
126
127    /**
128     *
129     * @param i
130     */
131    public void setValue(Number i) {
132        set_Value(i);
133    }
134
135}