source: tmcsimulator-scriptbuilder/trunk/src/event/editor/CADLogPanel.java @ 76

Revision 76, 4.6 KB checked in by bmcguffin, 9 years ago (diff)

Added javadoc for several files.

Line 
1package event.editor;
2
3import java.awt.event.*;
4import java.util.Observable;
5import scriptbuilder.structures.events.CADEvent;
6import scriptbuilder.structures.events.I_ScriptEvent;
7
8/**
9 *
10 * @author nathaniellehrer
11 */
12public class CADLogPanel extends javax.swing.JPanel implements RemoveablePanel, ScriptEventEditorPanel
13{
14
15    private ActionListener removeListener;
16    private CADEvent event;
17
18    /**
19     * Creates new form DetailPanel
20     */
21    public CADLogPanel()
22    {
23        initComponents();
24    }
25
26    public void setRemoveListener(ActionListener listener)
27    {
28        removeListener = listener;
29    }
30
31    /**
32     * Load the script event associated with this editor panel.
33     *
34     * @param sei The script event in question
35     */
36    @Override
37    public void getEventObject(I_ScriptEvent sei)
38    {
39        event = (CADEvent) sei;
40        CadTextField.setText(event.detail);
41        CadTextField.addKeyListener(new KeyListener()
42        {
43
44            public void keyTyped(KeyEvent e)
45            {
46            }
47
48            public void keyPressed(KeyEvent e)
49            {
50                if (e.getKeyCode() == KeyEvent.VK_ENTER)
51                {
52                    event.detail = CadTextField.getText();
53                }
54            }
55
56            public void keyReleased(KeyEvent e)
57            {
58            }
59        });
60    }
61
62    public void update(Observable o, Object arg)
63    {
64        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
65    }
66
67    /**
68     * This method is called from within the constructor to initialize the form.
69     * WARNING: Do NOT modify this code. The content of this method is always
70     * regenerated by the Form Editor.
71     */
72    @SuppressWarnings("unchecked")
73    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
74    private void initComponents()
75    {
76
77        removeButton = new javax.swing.JButton();
78        jLabel1 = new javax.swing.JLabel();
79        jScrollPane1 = new javax.swing.JScrollPane();
80        CadTextField = new javax.swing.JTextArea();
81
82        removeButton.setText("Remove");
83        removeButton.addMouseListener(new java.awt.event.MouseAdapter()
84        {
85            public void mouseClicked(java.awt.event.MouseEvent evt)
86            {
87                removeButtonremoveThisProperty(evt);
88            }
89        });
90
91        jLabel1.setText("Cad Log Text");
92
93        CadTextField.setColumns(20);
94        CadTextField.setRows(5);
95        jScrollPane1.setViewportView(CadTextField);
96
97        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
98        this.setLayout(layout);
99        layout.setHorizontalGroup(
100            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
101            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
102                .addContainerGap()
103                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
104                    .add(org.jdesktop.layout.GroupLayout.LEADING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 506, Short.MAX_VALUE)
105                    .add(layout.createSequentialGroup()
106                        .add(jLabel1)
107                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 330, Short.MAX_VALUE)
108                        .add(removeButton)))
109                .addContainerGap())
110        );
111        layout.setVerticalGroup(
112            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
113            .add(layout.createSequentialGroup()
114                .addContainerGap()
115                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
116                    .add(removeButton)
117                    .add(jLabel1))
118                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
119                .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 120, Short.MAX_VALUE)
120                .addContainerGap())
121        );
122    }// </editor-fold>//GEN-END:initComponents
123
124    private void removeButtonremoveThisProperty(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_removeButtonremoveThisProperty
125        if (removeListener != null)
126        {
127            removeListener.actionPerformed(new ActionEvent(this, 0, ""));
128        }
129}//GEN-LAST:event_removeButtonremoveThisProperty
130
131
132    // Variables declaration - do not modify//GEN-BEGIN:variables
133    private javax.swing.JTextArea CadTextField;
134    private javax.swing.JLabel jLabel1;
135    private javax.swing.JScrollPane jScrollPane1;
136    private javax.swing.JButton removeButton;
137    // End of variables declaration//GEN-END:variables
138
139}
Note: See TracBrowser for help on using the repository browser.