PageRenderTime 83ms CodeModel.GetById 41ms app.highlight 7ms RepoModel.GetById 33ms app.codeStats 0ms

/src/mpv5/ui/beans/LabeledDateChooser.java

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