| 1 | package event.editor; |
|---|
| 2 | |
|---|
| 3 | import java.awt.event.*; |
|---|
| 4 | import java.util.Observable; |
|---|
| 5 | import scriptbuilder.structures.events.CADEvent; |
|---|
| 6 | import scriptbuilder.structures.events.I_ScriptEvent; |
|---|
| 7 | |
|---|
| 8 | /** |
|---|
| 9 | * |
|---|
| 10 | * @author nathaniellehrer |
|---|
| 11 | */ |
|---|
| 12 | public class CADLogPanel extends javax.swing.JPanel implements I_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 | * Load the script event associated with this editor panel. |
|---|
| 27 | * |
|---|
| 28 | * @param sei The script event in question |
|---|
| 29 | */ |
|---|
| 30 | @Override |
|---|
| 31 | public void getEventObject(I_ScriptEvent sei) |
|---|
| 32 | { |
|---|
| 33 | event = (CADEvent) sei; |
|---|
| 34 | CadTextField.setText(event.detail); |
|---|
| 35 | CadTextField.addKeyListener(new KeyListener() |
|---|
| 36 | { |
|---|
| 37 | |
|---|
| 38 | public void keyTyped(KeyEvent e) |
|---|
| 39 | { |
|---|
| 40 | } |
|---|
| 41 | |
|---|
| 42 | public void keyPressed(KeyEvent e) |
|---|
| 43 | { |
|---|
| 44 | if (e.getKeyCode() == KeyEvent.VK_ENTER) |
|---|
| 45 | { |
|---|
| 46 | event.detail = CadTextField.getText(); |
|---|
| 47 | } |
|---|
| 48 | } |
|---|
| 49 | |
|---|
| 50 | public void keyReleased(KeyEvent e) |
|---|
| 51 | { |
|---|
| 52 | } |
|---|
| 53 | }); |
|---|
| 54 | } |
|---|
| 55 | |
|---|
| 56 | @Override |
|---|
| 57 | public void update(Observable o, Object arg) |
|---|
| 58 | { |
|---|
| 59 | throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. |
|---|
| 60 | } |
|---|
| 61 | |
|---|
| 62 | @Override |
|---|
| 63 | public boolean removeAssociatedEvent() |
|---|
| 64 | { |
|---|
| 65 | event.removeThis(); |
|---|
| 66 | event = null; |
|---|
| 67 | return true; |
|---|
| 68 | } |
|---|
| 69 | |
|---|
| 70 | /** |
|---|
| 71 | * This method is called from within the constructor to initialize the form. |
|---|
| 72 | * WARNING: Do NOT modify this code. The content of this method is always |
|---|
| 73 | * regenerated by the Form Editor. |
|---|
| 74 | */ |
|---|
| 75 | @SuppressWarnings("unchecked") |
|---|
| 76 | // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents |
|---|
| 77 | private void initComponents() |
|---|
| 78 | { |
|---|
| 79 | |
|---|
| 80 | jLabel1 = new javax.swing.JLabel(); |
|---|
| 81 | jScrollPane1 = new javax.swing.JScrollPane(); |
|---|
| 82 | CadTextField = new javax.swing.JTextArea(); |
|---|
| 83 | |
|---|
| 84 | jLabel1.setText("Cad Log Text"); |
|---|
| 85 | |
|---|
| 86 | CadTextField.setColumns(20); |
|---|
| 87 | CadTextField.setRows(5); |
|---|
| 88 | jScrollPane1.setViewportView(CadTextField); |
|---|
| 89 | |
|---|
| 90 | org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); |
|---|
| 91 | this.setLayout(layout); |
|---|
| 92 | layout.setHorizontalGroup( |
|---|
| 93 | layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
|---|
| 94 | .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() |
|---|
| 95 | .addContainerGap() |
|---|
| 96 | .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) |
|---|
| 97 | .add(org.jdesktop.layout.GroupLayout.LEADING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 506, Short.MAX_VALUE) |
|---|
| 98 | .add(layout.createSequentialGroup() |
|---|
| 99 | .add(jLabel1) |
|---|
| 100 | .add(0, 0, Short.MAX_VALUE))) |
|---|
| 101 | .addContainerGap()) |
|---|
| 102 | ); |
|---|
| 103 | layout.setVerticalGroup( |
|---|
| 104 | layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
|---|
| 105 | .add(layout.createSequentialGroup() |
|---|
| 106 | .add(19, 19, 19) |
|---|
| 107 | .add(jLabel1) |
|---|
| 108 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
|---|
| 109 | .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 120, Short.MAX_VALUE) |
|---|
| 110 | .addContainerGap()) |
|---|
| 111 | ); |
|---|
| 112 | }// </editor-fold>//GEN-END:initComponents |
|---|
| 113 | |
|---|
| 114 | |
|---|
| 115 | // Variables declaration - do not modify//GEN-BEGIN:variables |
|---|
| 116 | private javax.swing.JTextArea CadTextField; |
|---|
| 117 | private javax.swing.JLabel jLabel1; |
|---|
| 118 | private javax.swing.JScrollPane jScrollPane1; |
|---|
| 119 | // End of variables declaration//GEN-END:variables |
|---|
| 120 | |
|---|
| 121 | } |
|---|