Warning: Can't use blame annotator:
svn blame failed on branches/ScriptBuilder4/src/event/editor/UnitPanel.java: ("Can't find a temporary directory: Internal error", 20014)

source: tmcsimulator-scriptbuilder/branches/ScriptBuilder4/src/event/editor/UnitPanel.java @ 6

Revision 6, 7.1 KB checked in by jdalbey, 9 years ago (diff)

Add original prototype to branch

RevLine 
1package event.editor;
2
3import java.awt.event.*;
4
5/**
6 *
7 * @author nathaniellehrer
8 */
9public class UnitPanel extends javax.swing.JPanel implements RemoveablePanel {
10
11    private ActionListener removeListener;
12
13    /** Creates new form UnitPanel */
14    public UnitPanel() {
15        initComponents();
16
17        unitNumber.addFocusListener(new FocusListener() {
18
19            public void focusGained(FocusEvent e) {
20                help.setText("Unit number is formatted as #-#\t\tExample: 5-5");
21            }
22
23            public void focusLost(FocusEvent e) {
24                help.setText("");
25            }
26
27        });
28    }
29
30    public void setRemoveListener(ActionListener listener)
31    {
32        removeListener = listener;
33    }
34
35    /** This method is called from within the constructor to
36     * initialize the form.
37     * WARNING: Do NOT modify this code. The content of this method is
38     * always regenerated by the Form Editor.
39     */
40    @SuppressWarnings("unchecked")
41    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
42    private void initComponents() {
43
44        jLabel1 = new javax.swing.JLabel();
45        unitNumber = new javax.swing.JFormattedTextField();
46        removeButton = new javax.swing.JButton();
47        jLabel2 = new javax.swing.JLabel();
48        jComboBox1 = new javax.swing.JComboBox();
49        jLabel3 = new javax.swing.JLabel();
50        jComboBox2 = new javax.swing.JComboBox();
51        jLabel4 = new javax.swing.JLabel();
52        jComboBox3 = new javax.swing.JComboBox();
53        help = new javax.swing.JLabel();
54
55        jLabel1.setText("Unit Number");
56
57        try {
58            unitNumber.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("#-#")));
59        } catch (java.text.ParseException ex) {
60            ex.printStackTrace();
61        }
62
63        removeButton.setText("Remove");
64        removeButton.addMouseListener(new java.awt.event.MouseAdapter() {
65            public void mouseClicked(java.awt.event.MouseEvent evt) {
66                removeThisProperty(evt);
67            }
68        });
69
70        jLabel2.setText("Status");
71
72        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1098", "1097", "ENRT" }));
73
74        jLabel3.setText("Primary");
75
76        jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "True", "False" }));
77
78        jLabel4.setText("Active");
79
80        jComboBox3.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "True", "False" }));
81
82        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
83        this.setLayout(layout);
84        layout.setHorizontalGroup(
85            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
86            .add(layout.createSequentialGroup()
87                .addContainerGap()
88                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
89                    .add(org.jdesktop.layout.GroupLayout.TRAILING, removeButton)
90                    .add(org.jdesktop.layout.GroupLayout.TRAILING, help, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 565, Short.MAX_VALUE)
91                    .add(layout.createSequentialGroup()
92                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
93                            .add(jLabel1)
94                            .add(jLabel2))
95                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
96                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
97                            .add(jComboBox1, 0, 475, Short.MAX_VALUE)
98                            .add(unitNumber, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 475, Short.MAX_VALUE)))
99                    .add(layout.createSequentialGroup()
100                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
101                            .add(jLabel3)
102                            .add(jLabel4))
103                        .add(43, 43, 43)
104                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
105                            .add(jComboBox3, 0, 475, Short.MAX_VALUE)
106                            .add(jComboBox2, 0, 475, Short.MAX_VALUE))))
107                .addContainerGap())
108        );
109        layout.setVerticalGroup(
110            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
111            .add(layout.createSequentialGroup()
112                .addContainerGap()
113                .add(removeButton)
114                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
115                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
116                    .add(jLabel1)
117                    .add(unitNumber, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
118                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
119                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
120                    .add(jLabel2)
121                    .add(jComboBox1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
122                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
123                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
124                    .add(jLabel3)
125                    .add(jComboBox2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
126                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
127                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
128                    .add(jLabel4)
129                    .add(jComboBox3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
130                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 128, Short.MAX_VALUE)
131                .add(help, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 20, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
132                .addContainerGap())
133        );
134    }// </editor-fold>//GEN-END:initComponents
135
136    private void removeThisProperty(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_removeThisProperty
137        if (removeListener != null)
138        {
139            removeListener.actionPerformed(new ActionEvent(this, 0, ""));
140        }
141    }//GEN-LAST:event_removeThisProperty
142
143
144    // Variables declaration - do not modify//GEN-BEGIN:variables
145    private javax.swing.JLabel help;
146    private javax.swing.JComboBox jComboBox1;
147    private javax.swing.JComboBox jComboBox2;
148    private javax.swing.JComboBox jComboBox3;
149    private javax.swing.JLabel jLabel1;
150    private javax.swing.JLabel jLabel2;
151    private javax.swing.JLabel jLabel3;
152    private javax.swing.JLabel jLabel4;
153    private javax.swing.JButton removeButton;
154    private javax.swing.JFormattedTextField unitNumber;
155    // End of variables declaration//GEN-END:variables
156
157}
Note: See TracBrowser for help on using the repository browser.