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

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

Add original prototype to branch

Line 
1package event.editor;
2
3import java.awt.event.*;
4import javax.swing.*;
5import java.util.*;
6import javax.swing.table.*;
7
8/**
9 *
10 * @author nathaniellehrer
11 */
12public class TelephonePanel extends javax.swing.JPanel {
13
14    private ActionListener removeListener;
15    private JTable dialogTable;
16
17    /** Creates new form TelephonePanel */
18    public TelephonePanel() {
19        initComponents();
20        HashMap<JButton, String> buttonMap = new HashMap<JButton, String>();
21        buttonMap.put(addInstructorButton, "Instructor");
22        buttonMap.put(addStudentButton, "Student");
23        GenericTable.genericizeTable(jScrollPane1, buttonMap, deleteSelectedButton);
24    }
25   
26    /** This method is called from within the constructor to
27     * initialize the form.
28     * WARNING: Do NOT modify this code. The content of this method is
29     * always regenerated by the Form Editor.
30     */
31    @SuppressWarnings("unchecked")
32    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
33    private void initComponents() {
34
35        addStudentButton = new javax.swing.JButton();
36        jScrollPane1 = new javax.swing.JScrollPane();
37        deleteSelectedButton = new javax.swing.JButton();
38        addInstructorButton = new javax.swing.JButton();
39        jTextField1 = new javax.swing.JTextField();
40        jLabel1 = new javax.swing.JLabel();
41        removeButton = new javax.swing.JButton();
42
43        addStudentButton.setText("Add Student Line");
44        addStudentButton.setToolTipText("Adds a row for student dialog in the table");
45
46        jScrollPane1.setHorizontalScrollBar(null);
47
48        deleteSelectedButton.setText("Delete Selected Line");
49        deleteSelectedButton.setToolTipText("Deletes the selected row in the table");
50
51        addInstructorButton.setText("Add Instructor Line");
52        addInstructorButton.setToolTipText("Adds a row for instructor dialog in the table");
53
54        jTextField1.setToolTipText("Specifies the role the instructor plays");
55
56        jLabel1.setText("Role of instructor:");
57
58        removeButton.setText("Remove");
59        removeButton.setToolTipText("Removes this property");
60        removeButton.addMouseListener(new java.awt.event.MouseAdapter() {
61            public void mouseClicked(java.awt.event.MouseEvent evt) {
62                removeThisProperty(evt);
63            }
64        });
65
66        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
67        this.setLayout(layout);
68        layout.setHorizontalGroup(
69            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
70            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
71                .addContainerGap()
72                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
73                    .add(org.jdesktop.layout.GroupLayout.LEADING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 602, Short.MAX_VALUE)
74                    .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
75                        .add(jLabel1)
76                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
77                        .add(jTextField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 478, Short.MAX_VALUE))
78                    .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
79                        .add(addInstructorButton)
80                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
81                        .add(addStudentButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 173, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
82                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
83                        .add(deleteSelectedButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 178, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
84                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 86, Short.MAX_VALUE))
85                    .add(removeButton))
86                .add(26, 26, 26))
87        );
88        layout.setVerticalGroup(
89            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
90            .add(layout.createSequentialGroup()
91                .addContainerGap()
92                .add(removeButton)
93                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
94                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
95                    .add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
96                    .add(jLabel1))
97                .add(18, 18, 18)
98                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
99                    .add(addInstructorButton)
100                    .add(addStudentButton)
101                    .add(deleteSelectedButton))
102                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
103                .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 310, Short.MAX_VALUE)
104                .addContainerGap())
105        );
106    }// </editor-fold>//GEN-END:initComponents
107
108    private void removeThisProperty(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_removeThisProperty
109        if (removeListener != null)
110        {
111            removeListener.actionPerformed(new ActionEvent(this, 0, ""));
112        }
113    }//GEN-LAST:event_removeThisProperty
114
115
116    // Variables declaration - do not modify//GEN-BEGIN:variables
117    private javax.swing.JButton addInstructorButton;
118    private javax.swing.JButton addStudentButton;
119    private javax.swing.JButton deleteSelectedButton;
120    private javax.swing.JLabel jLabel1;
121    private javax.swing.JScrollPane jScrollPane1;
122    private javax.swing.JTextField jTextField1;
123    private javax.swing.JButton removeButton;
124    // End of variables declaration//GEN-END:variables
125
126}
Note: See TracBrowser for help on using the repository browser.