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

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

Revision 6, 6.6 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 CCTVPanel extends javax.swing.JPanel implements RemoveablePanel {
10
11    private ActionListener removeListener;
12
13    /** Creates new form CCTVInfoPanel */
14    public CCTVPanel() {
15        initComponents();
16
17        dir.addFocusListener(new FocusListener() {
18
19            public void focusGained(FocusEvent e) {
20                help.setText("Dir is an integer or decimal");
21            }
22
23            public void focusLost(FocusEvent e) {
24                help.setText("");
25            }
26
27        });
28
29        toggle.addFocusListener(new FocusListener() {
30
31            public void focusGained(FocusEvent e) {
32                help.setText("toggle is an integer or decimal");
33            }
34
35            public void focusLost(FocusEvent e) {
36                help.setText("");
37            }
38
39        });
40    }
41
42
43    public void setRemoveListener(ActionListener listener)
44    {
45        removeListener = listener;
46    }
47
48    public boolean isOptional()
49    {
50        return false;
51    }
52
53    /** This method is called from within the constructor to
54     * initialize the form.
55     * WARNING: Do NOT modify this code. The content of this method is
56     * always regenerated by the Form Editor.
57     */
58    @SuppressWarnings("unchecked")
59    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
60    private void initComponents() {
61
62        removeButton = new javax.swing.JButton();
63        jLabel1 = new javax.swing.JLabel();
64        dir = new javax.swing.JFormattedTextField();
65        jLabel3 = new javax.swing.JLabel();
66        jTextField1 = new javax.swing.JTextField();
67        jLabel2 = new javax.swing.JLabel();
68        toggle = new javax.swing.JFormattedTextField();
69        help = new javax.swing.JLabel();
70
71        removeButton.setText("Remove");
72        removeButton.addMouseListener(new java.awt.event.MouseAdapter() {
73            public void mouseClicked(java.awt.event.MouseEvent evt) {
74                removeButtonremoveThisProperty(evt);
75            }
76        });
77        removeButton.addActionListener(new java.awt.event.ActionListener() {
78            public void actionPerformed(java.awt.event.ActionEvent evt) {
79                removeButtonActionPerformed(evt);
80            }
81        });
82
83        jLabel1.setText("ID");
84
85        dir.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter()));
86
87        jLabel3.setText("Toggle");
88
89        jLabel2.setText("Dir");
90
91        toggle.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter()));
92
93        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
94        this.setLayout(layout);
95        layout.setHorizontalGroup(
96            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
97            .add(layout.createSequentialGroup()
98                .addContainerGap()
99                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
100                    .add(org.jdesktop.layout.GroupLayout.TRAILING, help, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 540, Short.MAX_VALUE)
101                    .add(org.jdesktop.layout.GroupLayout.TRAILING, removeButton)
102                    .add(layout.createSequentialGroup()
103                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
104                            .add(jLabel1)
105                            .add(jLabel2)
106                            .add(jLabel3))
107                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
108                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
109                            .add(jTextField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 487, Short.MAX_VALUE)
110                            .add(dir, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 487, Short.MAX_VALUE)
111                            .add(toggle, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 487, Short.MAX_VALUE))))
112                .addContainerGap())
113        );
114        layout.setVerticalGroup(
115            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
116            .add(layout.createSequentialGroup()
117                .addContainerGap()
118                .add(removeButton)
119                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
120                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
121                    .add(jLabel1)
122                    .add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
123                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
124                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
125                    .add(jLabel2)
126                    .add(dir, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
127                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
128                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
129                    .add(jLabel3)
130                    .add(toggle, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
131                .add(48, 48, 48)
132                .add(help, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 13, Short.MAX_VALUE)
133                .addContainerGap())
134        );
135    }// </editor-fold>//GEN-END:initComponents
136
137    private void removeButtonremoveThisProperty(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_removeButtonremoveThisProperty
138        if (removeListener != null) {
139            removeListener.actionPerformed(new ActionEvent(this, 0, ""));
140        }
141}//GEN-LAST:event_removeButtonremoveThisProperty
142
143    private void removeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeButtonActionPerformed
144        // TODO add your handling code here:
145}//GEN-LAST:event_removeButtonActionPerformed
146
147
148    // Variables declaration - do not modify//GEN-BEGIN:variables
149    private javax.swing.JFormattedTextField dir;
150    private javax.swing.JLabel help;
151    private javax.swing.JLabel jLabel1;
152    private javax.swing.JLabel jLabel2;
153    private javax.swing.JLabel jLabel3;
154    private javax.swing.JTextField jTextField1;
155    private javax.swing.JButton removeButton;
156    private javax.swing.JFormattedTextField toggle;
157    // End of variables declaration//GEN-END:variables
158
159}
Note: See TracBrowser for help on using the repository browser.