Changeset 151
- Timestamp:
- 08/09/11 15:14:11 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/swing/DlgSequenceDetails.java
r139 r151 2 2 3 3 import java.awt.EventQueue; 4 import java.awt.Rectangle; 4 5 5 6 import javax.swing.JFrame; 6 7 import javax.swing.JButton; 8 import javax.swing.JScrollBar; 9 7 10 import java.awt.event.MouseAdapter; 8 11 import java.awt.event.MouseEvent; … … 64 67 final javax.swing.DefaultListModel modelListEvents = new javax.swing.DefaultListModel(); 65 68 final javax.swing.DefaultListModel modelListTargets = new javax.swing.DefaultListModel(); 66 final JList list Sequences = new JList(modelListEvents);69 final JList listEvents = new JList(modelListEvents); 67 70 final JList listTargets = new JList(modelListTargets); 68 71 // *** … … 72 75 frmEvents.setResizable(false); 73 76 frmEvents.setTitle("Sequence details"); 74 frmEvents.setBounds(100, 100, 666, 492);77 frmEvents.setBounds(100, 100, 731, 589); 75 78 frmEvents.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); 76 79 frmEvents.getContentPane().setLayout(null); … … 87 90 JPanel panel = new JPanel(); 88 91 panel.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); 89 panel.setBounds(10, 4 02, 639, 52);92 panel.setBounds(10, 498, 705, 52); 90 93 frmEvents.getContentPane().add(panel); 91 94 panel.setLayout(null); 92 95 final JButton btnInsertBefore = new JButton("Insert before"); 93 btnInsertBefore.setBounds(10, 11, 1 24, 31);96 btnInsertBefore.setBounds(10, 11, 135, 31); 94 97 panel.add(btnInsertBefore); 95 98 // *** … … 101 104 return; 102 105 103 int selectedIndex = list Sequences.getSelectedIndex();106 int selectedIndex = listEvents.getSelectedIndex(); 104 107 DlgInsert.showDialog(events, selectedIndex, true); 105 108 106 109 updateLists(events, modelListEvents, modelListTargets); 107 list Sequences.setSelectedIndex(selectedIndex);110 listEvents.setSelectedIndex(selectedIndex); 108 111 } 109 112 }); … … 111 114 btnInsertBefore.setEnabled(false); 112 115 final JButton btnInsertAfter = new JButton("Insert after"); 113 btnInsertAfter.setBounds(1 44, 11, 124, 31);116 btnInsertAfter.setBounds(155, 11, 135, 31); 114 117 panel.add(btnInsertAfter); 115 118 // *** … … 121 124 return; 122 125 123 int selectedIndex = list Sequences.getSelectedIndex();126 int selectedIndex = listEvents.getSelectedIndex(); 124 127 DlgInsert.showDialog(events, selectedIndex, false); 125 128 126 129 updateLists(events, modelListEvents, modelListTargets); 127 list Sequences.setSelectedIndex(selectedIndex + 1);130 listEvents.setSelectedIndex(selectedIndex + 1); 128 131 } 129 132 }); … … 132 135 133 136 final JButton btnClose = new JButton("Back to sequences"); 134 btnClose.setBounds(5 05, 11, 124, 31);137 btnClose.setBounds(559, 11, 135, 31); 135 138 panel.add(btnClose); 136 139 137 140 JPanel panel_1 = new JPanel(); 138 141 panel_1.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); 139 panel_1.setBounds(10, 11, 639, 380);142 panel_1.setBounds(10, 11, 705, 476); 140 143 frmEvents.getContentPane().add(panel_1); 141 144 panel_1.setLayout(null); 142 145 143 JScrollPane scrollPane_1= new JScrollPane();144 scrollPane _1.setBounds(10, 29, 309, 339);145 panel_1.add(scrollPane _1);146 scrollPane _1.setViewportView(listSequences);147 // *** 148 149 // JList: list Sequences ***150 list Sequences.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null,146 final JScrollPane scrollPaneEvents = new JScrollPane(); 147 scrollPaneEvents.setBounds(10, 29, 338, 436); 148 panel_1.add(scrollPaneEvents); 149 scrollPaneEvents.setViewportView(listEvents); 150 // *** 151 152 // JList: listEvents *** 153 listEvents.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, 151 154 null, null, null)); 152 list Sequences.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);155 listEvents.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 153 156 154 157 // JScrollPane: scrollPane 155 JScrollPane scrollPane = new JScrollPane(); 156 scrollPane.setBounds(329, 29, 298, 339); 157 panel_1.add(scrollPane); 158 final JScrollPane scrollPaneTargets = new JScrollPane(); 159 scrollPaneTargets.setBounds(358, 29, 337, 436); 160 panel_1.add(scrollPaneTargets); 161 162 Rectangle r = scrollPaneEvents.getBounds(); 163 r.height -= 18; 164 if(scrollPaneEvents.getVerticalScrollBar().isVisible()) scrollPaneEvents.setBounds(r); 158 165 159 166 listTargets.addListSelectionListener(new ListSelectionListener() { 160 167 public void valueChanged(ListSelectionEvent arg0) { 161 168 if (listTargets.getSelectedIndex() > -1) { 162 listSequences.setSelectedIndex(listTargets 169 170 JScrollBar bar1 = scrollPaneEvents.getVerticalScrollBar(); 171 JScrollBar bar2 = scrollPaneTargets.getVerticalScrollBar(); 172 bar1.setValue(bar2.getValue()); 173 174 listEvents.setSelectedIndex(listTargets 163 175 .getSelectedIndex()); 164 176 btnInsertAfter.setEnabled(true); … … 172 184 } 173 185 }); 174 scrollPane .setViewportView(listTargets);186 scrollPaneTargets.setViewportView(listTargets); 175 187 // *** 176 188 … … 185 197 186 198 JLabel lblTargets = new JLabel("Targets:"); 187 lblTargets.setBounds(3 29, 11, 58, 14);199 lblTargets.setBounds(358, 11, 58, 14); 188 200 panel_1.add(lblTargets); 189 201 190 list Sequences.addListSelectionListener(new ListSelectionListener() {202 listEvents.addListSelectionListener(new ListSelectionListener() { 191 203 public void valueChanged(ListSelectionEvent arg0) { 192 if (listSequences.getSelectedIndex() > -1) { 193 listTargets.setSelectedIndex(listSequences 194 .getSelectedIndex()); 195 196 if (listSequences.getSelectedIndex() == 0) { 204 if (listEvents.getSelectedIndex() > -1) { 205 206 JScrollBar bar1 = scrollPaneEvents.getVerticalScrollBar(); 207 JScrollBar bar2 = scrollPaneTargets.getVerticalScrollBar(); 208 bar2.setValue(bar1.getValue()); 209 210 listTargets.setSelectedIndex(listEvents 211 .getSelectedIndex()); 212 213 if (listEvents.getSelectedIndex() == 0) { 197 214 btnInsertBefore.setEnabled(false); 198 215 btnInsertAfter.setEnabled(true);
Note: See TracChangeset
for help on using the changeset viewer.