1 package devisor2.grid.GUI.dialogs; 2 3 import java.util.*; 4 5 import java.awt.*; 6 import java.awt.event.*; 7 import javax.swing.*; 8 import javax.swing.border.*; 9 10 import devisor2.grid.options.*; 11 import devisor2.grid.GUI.framework.*; 12 import devisor2.grid.GUI.event.*; 13 14 /** 15 * This class represents the OptionsDialog for the DeViSoR2 application. 16 * <br> 17 * On various tabbed panes (tabsheets), the user can set all options 18 * for the application. All options are managed internally in the class 19 * Options in package options, which also defines the default values 20 * which can be restored if the user wants to. <br> 21 * <br> 22 * Like every dialog in the application, it is controlled via two static 23 * methods: "initialize" has to be called once (e.g. in the startup class) 24 * and again every time the look&feel is changed. then, the dialog can be 25 * displayed whenever neccessary using the "showDialog" method. <br> 26 * <br> 27 * This is how the dialog works: <br> 28 * The user can change the options via TextInputFields, secondary dialogs, 29 * tables and other GUI-only elements. This only affects the representation 30 * in the dialog (i.e. in the GUI), nothing is written back into the 31 * Options instance. <br> 32 * If the user clicks on CANCEL, all changes that have beed made are 33 * ignored and the dialog is closed. Accordingly, all changes are ignored 34 * if the user clicks the LOAD respectively RESTORE DEFAULTS buttons. 35 * Only if the user clicks on APPLY or SAVE, the Options instance is 36 * updated before closing the dialog or writing the Options file to disk. 37 * Note that updating might take quite a while, especially when GUI elements 38 * such as the menu (for accelerators) or even the whole GUI (for look&feel) 39 * are reconfigured and repainted. <br> 40 * <br> 41 * A short description of the settings and how they are managed:<br> 42 * - The internal storage of Options is described in the Options class, see 43 * there for details. Note that only Strings are stored.<br> 44 * - everything that is represented by a String (such as paths etc) are 45 * stored the way they are without further changes. <br> 46 * - Path input is implemented in two ways: the user can directly type 47 * the path into a textfield (followed by a short check by the program 48 * of course), or he can use the dialog provided to browse the directory 49 * tree to his destination path. <br> 50 * - The draw flags on the DRAW tab sheet are stored as String literals 51 * <code>true<\code> and <code>false<\code> respectively.<br> 52 * - To assign new colors to certain elements and displayed items, an 53 * instance of the default JColorChooser Dialog is displayed when the 54 * corresponding button is clicked. Colors are converted to an integer 55 * representing the color in the RGBA model. <br> 56 * - Accelerator input is implemented as follows: In a JTable, all available 57 * functions that accelerators can be assigned to are listed, allowing the 58 * user to pick the function he wants to reassign. Then, the modifier and 59 * key can be changed via radiobuttons and a combobox. The user has to 60 * click the APPLY button explicitly to notify the table (the data model 61 * of which holds the accelerators). Note that APPLY only updates the table 62 * and not the Options instance, consistent with the general behaviour of 63 * this dialog. Assigning the NONE accelerator to a function disables 64 * keyboard support for the specified function. This can be accomplished 65 * by clicking the REMOVE button.<br> 66 * 67 * 68 * 69 * - as soon as other options are added, i will update this description 70 * subsequently<br> 71 * 72 * 73 * 74 * @author Dominik Goeddeke 75 * @version 0.9 (for Options declared so far, full GUI support available) 76 * @see options.Options 77 */ 78 public class OptionsDialog extends JDialog 79 { 80 // a static self-reference used for the two public static methods 81 private static OptionsDialog dialog; 82 // the parent frame where the dialog is centered on 83 private MainFrame parent; 84 // the actionlistener object 85 private OptionsActionListener actionlistener; 86 // the ControlCenter reference 87 private ControlCenter cc; 88 89 /** 90 * creates a new Dialog and sets up its gui. 91 * please don't use this constructor directly, use the two static 92 * methods provided. 93 * 94 * @param parent - the mainframe connects the dialog to the rest of the 95 * application. 96 */ OptionsDialog(MainFrame parent)97 public OptionsDialog (MainFrame parent) 98 { 99 // basics and attribute initialisation 100 super (parent,true); 101 this.parent = parent; 102 actionlistener = new OptionsActionListener (parent,this); 103 cc = ControlCenter.getMyself(); 104 // gui and event handling 105 initDialog (); 106 initGeneralPanel (); 107 initDrawPanel (); 108 initColorPanel (); 109 initAcceleratorPanel (); 110 initAddonPanel (); 111 initOtherPanel (); 112 // ok all done 113 getContentPane().add(tabs,BorderLayout.CENTER); 114 pack(); 115 } 116 117 118 /** 119 * creates basic layout, the south panel for the buttons, 120 * positioning etc. 121 */ initDialog()122 private void initDialog () 123 { 124 tabs = new JTabbedPane (); 125 getContentPane().setLayout (new BorderLayout()); 126 setTitle ((String)cc.rb.getObject ("options_OptionsDialog_general_title")); 127 setDefaultCloseOperation (DO_NOTHING_ON_CLOSE); 128 // south panel includes a couple of buttons 129 JPanel buttons = new JPanel (); 130 buttons.setLayout (new FlowLayout ()); 131 JButton accept = new JButton ((String)cc.rb.getObject ("options_OptionsDialog_acceptButton")); 132 accept.setToolTipText ((String)cc.rb.getObject ("options_OptionsDialog_acceptButton_tooltip")); 133 accept.setMnemonic (((Integer)cc.rb.getObject("options_OptionsDialog_acceptButton_mnemonic")).intValue()); 134 accept.addActionListener (actionlistener); 135 accept.setActionCommand (OptionsActionListener.ACCEPT); 136 buttons.add(accept); 137 JButton cancel = new JButton((String)cc.rb.getObject ("options_OptionsDialog_cancelButton")); 138 cancel.setToolTipText ((String)cc.rb.getObject ("options_OptionsDialog_cancelButton_tooltip")); 139 cancel.setMnemonic (((Integer)cc.rb.getObject("options_OptionsDialog_cancelButton_mnemonic")).intValue()); 140 cancel.addActionListener (actionlistener); 141 cancel.setActionCommand (OptionsActionListener.CANCEL); 142 buttons.add(cancel); 143 JButton load = new JButton((String)cc.rb.getObject ("options_OptionsDialog_loadButton")); 144 load.setToolTipText ((String)cc.rb.getObject ("options_OptionsDialog_loadButton_tooltip")); 145 load.setMnemonic (((Integer)cc.rb.getObject("options_OptionsDialog_loadButton_mnemonic")).intValue()); 146 load.addActionListener (actionlistener); 147 load.setActionCommand (OptionsActionListener.LOAD); 148 buttons.add(load); 149 JButton save = new JButton((String)cc.rb.getObject ("options_OptionsDialog_saveButton")); 150 save.setToolTipText ((String)cc.rb.getObject ("options_OptionsDialog_saveButton_tooltip")); 151 save.setMnemonic (((Integer)cc.rb.getObject("options_OptionsDialog_saveButton_mnemonic")).intValue()); 152 save.addActionListener (actionlistener); 153 save.setActionCommand (OptionsActionListener.SAVE); 154 buttons.add(save); 155 JButton reset = new JButton((String)cc.rb.getObject ("options_OptionsDialog_resetButton")); 156 reset.setToolTipText ((String)cc.rb.getObject ("options_OptionsDialog_resetButton_tooltip")); 157 reset.setMnemonic (((Integer)cc.rb.getObject("options_OptionsDialog_resetButton_mnemonic")).intValue()); 158 reset.addActionListener (actionlistener); 159 reset.setActionCommand (OptionsActionListener.RESET); 160 buttons.add(reset); 161 JButton help = new JButton((String)cc.rb.getObject ("options_OptionsDialog_helpButton")); 162 help.setToolTipText ((String)cc.rb.getObject ("options_OptionsDialog_helpButton_tooltip")); 163 help.setMnemonic (((Integer)cc.rb.getObject("options_OptionsDialog_helpButton_mnemonic")).intValue()); 164 help.addActionListener (actionlistener); 165 help.setActionCommand (OptionsActionListener.HELP); 166 buttons.add(help); 167 // add the buttons 168 getContentPane().add (buttons,BorderLayout.SOUTH); 169 // and make the accept button the default one 170 getRootPane().setDefaultButton (accept); 171 } 172 173 /** creates the GUI for the GENERAL tab */ initGeneralPanel()174 private void initGeneralPanel () 175 { 176 JLabel label; 177 generalPanel = new JPanel (); 178 generalPanel.setBorder (new EmptyBorder (10,10,10,10)); 179 GridBagLayout layout = new GridBagLayout (); 180 GridBagConstraints constraints = new GridBagConstraints (); 181 generalPanel.setLayout (layout); 182 183 // DEVISORHOME selection 184 label = new JLabel ((String)cc.rb.getObject ("options_OptionsDialog_generalPanel_devisorhome")+":"); 185 constraints.gridy = 0; 186 constraints.gridx = 0; 187 layout.setConstraints (label, constraints); 188 generalPanel.add (label); 189 devhomeTextField = new JTextField (30); 190 // devhomeTextField.setMaximumSize (new Dimension (100,31)); 191 //devhomeTextField.setMinimumSize (new Dimension (100,31)); 192 //devhomeTextField.setPreferredSize (new Dimension (100,31)); 193 constraints.gridx = 1; 194 layout.setConstraints (devhomeTextField, constraints); 195 generalPanel.add (devhomeTextField); 196 devhomeButton = new JButton ("..."); 197 devhomeButton.setActionCommand (OptionsActionListener.DEVHOME); 198 devhomeButton.addActionListener (actionlistener); 199 // devhomeButton.setMaximumSize (new Dimension (31,31)); 200 // devhomeButton.setMinimumSize (new Dimension (31,30)); 201 // devhomeButton.setPreferredSize (new Dimension (31,30)); 202 devhomeButton.setToolTipText ((String)cc.rb.getObject ("options_OptionsDialog_generalPanel_devisorhome_tooltip")); 203 constraints.gridx = 2; 204 layout.setConstraints (devhomeButton, constraints); 205 generalPanel.add (devhomeButton); 206 // GENERAL PATH 207 label = new JLabel ((String)cc.rb.getObject ("options_OptionsDialog_generalPanel_generalpath")+":"); 208 constraints.gridy = 1; 209 constraints.gridx = 0; 210 layout.setConstraints (label, constraints); 211 generalPanel.add (label); 212 generalpathTextField = new JTextField (30); 213 // generalpathTextField.setMaximumSize (new Dimension (100,31)); 214 // generalpathTextField.setMinimumSize (new Dimension (100,31)); 215 // generalpathTextField.setPreferredSize (new Dimension (100,31)); 216 constraints.gridx = 1; 217 layout.setConstraints (generalpathTextField, constraints); 218 generalPanel.add (generalpathTextField); 219 generalpathButton = new JButton ("..."); 220 generalpathButton.setActionCommand (OptionsActionListener.PATH); 221 generalpathButton.addActionListener (actionlistener); 222 // generalpathButton.setMaximumSize (new Dimension (31,31)); 223 // generalpathButton.setMinimumSize (new Dimension (31,30)); 224 // generalpathButton.setPreferredSize (new Dimension (31,30)); 225 generalpathButton.setToolTipText ((String)cc.rb.getObject ("options_OptionsDialog_generalPanel_generalpath_tooltip")); 226 constraints.gridx = 2; 227 layout.setConstraints (generalpathButton, constraints); 228 generalPanel.add (generalpathButton); 229 // Trigen Path 230 label = new JLabel ((String)cc.rb.getObject ("options_OptionsDialog_generalPanel_trigen")+":"); 231 constraints.gridy = 2; 232 constraints.gridx = 0; 233 layout.setConstraints (label, constraints); 234 generalPanel.add (label); 235 trigenTextField = new JTextField (30); 236 // trigenTextField.setMaximumSize (new Dimension (100,31)); 237 // trigenTextField.setMinimumSize (new Dimension (100,31)); 238 // trigenTextField.setPreferredSize (new Dimension (100,31)); 239 constraints.gridx = 1; 240 layout.setConstraints (trigenTextField, constraints); 241 generalPanel.add (trigenTextField); 242 trigenButton = new JButton ("..."); 243 trigenButton.setActionCommand (OptionsActionListener.TRIGEN); 244 trigenButton.addActionListener (actionlistener); 245 // trigenButton.setMaximumSize (new Dimension (31,31)); 246 // trigenButton.setMinimumSize (new Dimension (31,30)); 247 // trigenButton.setPreferredSize (new Dimension (31,30)); 248 trigenButton.setToolTipText ((String)cc.rb.getObject ("options_OptionsDialog_generalPanel_trigen_tooltip")); 249 constraints.gridx = 2; 250 layout.setConstraints (trigenButton, constraints); 251 generalPanel.add (trigenButton); 252 // Feat Library Path 253 label = new JLabel ((String)cc.rb.getObject ("options_OptionsDialog_generalPanel_featlib")+":"); 254 constraints.gridy = 3; 255 constraints.gridx = 0; 256 layout.setConstraints (label, constraints); 257 generalPanel.add (label); 258 featlibTextField = new JTextField (30); 259 // featlibTextField.setMaximumSize (new Dimension (100,31)); 260 // featlibTextField.setMinimumSize (new Dimension (100,31)); 261 // featlibTextField.setPreferredSize (new Dimension (100,31)); 262 constraints.gridx = 1; 263 layout.setConstraints (featlibTextField, constraints); 264 generalPanel.add (featlibTextField); 265 featlibButton = new JButton ("..."); 266 featlibButton.setActionCommand (OptionsActionListener.FEATLIB); 267 featlibButton.addActionListener (actionlistener); 268 // featlibButton.setMaximumSize (new Dimension (31,31)); 269 // featlibButton.setMinimumSize (new Dimension (31,30)); 270 // featlibButton.setPreferredSize (new Dimension (31,30)); 271 featlibButton.setToolTipText ((String)cc.rb.getObject ("options_OptionsDialog_generalPanel_featlib_tooltip")); 272 constraints.gridx = 2; 273 layout.setConstraints (featlibButton, constraints); 274 generalPanel.add (featlibButton); 275 tabs.addTab ((String)cc.rb.getObject ("options_OptionsDialog_generalPanel_tabheader"),null,generalPanel,(String)cc.rb.getObject ("options_OptionsDialog_generalPanel_tabheader_tooltip")); 276 } 277 278 /** creates the GUI for the DRAW tab */ initDrawPanel()279 private void initDrawPanel () 280 { 281 drawPanel = new JPanel (); 282 drawPanel.setBorder (new EmptyBorder (10,10,10,10)); 283 GridBagLayout layout = new GridBagLayout (); 284 GridBagConstraints constraints = new GridBagConstraints (); 285 drawPanel.setLayout (layout); 286 constraints.fill = GridBagConstraints.HORIZONTAL; 287 constraints.weightx = 1.0; 288 // boundary 289 JPanel boundary = new JPanel (); 290 boundary.setLayout (new BoxLayout (boundary,BoxLayout.Y_AXIS)); 291 boundary.setBorder (BorderFactory.createTitledBorder((String)cc.rb.getObject ("options_OptionsDialog_drawPanel_boundary_header"))); 292 drawboundaryCheck = new JCheckBox ((String)cc.rb.getObject ("options_OptionsDialog_drawPanel_boundary_draw")); 293 boundary.add (drawboundaryCheck); 294 numberboundaryCheck = new JCheckBox ((String)cc.rb.getObject ("options_OptionsDialog_drawPanel_boundary_number")); 295 boundary.add (numberboundaryCheck); 296 // node 297 JPanel node = new JPanel (); 298 node.setLayout (new BoxLayout (node,BoxLayout.Y_AXIS)); 299 node.setBorder (BorderFactory.createTitledBorder((String)cc.rb.getObject ("options_OptionsDialog_drawPanel_node_header"))); 300 drawnodeCheck = new JCheckBox ((String)cc.rb.getObject ("options_OptionsDialog_drawPanel_node_draw")); 301 node.add (drawnodeCheck); 302 numbernodeCheck = new JCheckBox ((String)cc.rb.getObject ("options_OptionsDialog_drawPanel_node_number")); 303 node.add (numbernodeCheck); 304 // edge 305 JPanel edge = new JPanel (); 306 edge.setLayout (new BoxLayout (edge,BoxLayout.Y_AXIS)); 307 edge.setBorder (BorderFactory.createTitledBorder((String)cc.rb.getObject ("options_OptionsDialog_drawPanel_edge_header"))); 308 drawedgeCheck = new JCheckBox ((String)cc.rb.getObject ("options_OptionsDialog_drawPanel_edge_draw")); 309 edge.add (drawedgeCheck); 310 numberedgeCheck = new JCheckBox ((String)cc.rb.getObject ("options_OptionsDialog_drawPanel_edge_number")); 311 edge.add (numberedgeCheck); 312 // element 313 JPanel element = new JPanel (); 314 element.setLayout (new BoxLayout (element,BoxLayout.Y_AXIS)); 315 element.setBorder (BorderFactory.createTitledBorder((String)cc.rb.getObject ("options_OptionsDialog_drawPanel_element_header"))); 316 drawelementCheck = new JCheckBox ((String)cc.rb.getObject ("options_OptionsDialog_drawPanel_element_draw")); 317 element.add (drawelementCheck); 318 numberelementCheck = new JCheckBox ((String)cc.rb.getObject ("options_OptionsDialog_drawPanel_element_number")); 319 element.add (numberelementCheck); 320 crosselementCheck = new JCheckBox ((String)cc.rb.getObject ("options_OptionsDialog_drawPanel_element_cross")); 321 element.add (crosselementCheck); 322 fillelementCheck = new JCheckBox ((String)cc.rb.getObject ("options_OptionsDialog_drawPanel_element_fill")); 323 element.add (fillelementCheck); 324 // misc 325 JPanel misc = new JPanel (); 326 misc.setLayout (new BoxLayout (misc,BoxLayout.Y_AXIS)); 327 misc.setBorder (BorderFactory.createTitledBorder((String)cc.rb.getObject ("options_OptionsDialog_drawPanel_misc_header"))); 328 drawgridCheck = new JCheckBox ((String)cc.rb.getObject ("options_OptionsDialog_drawPanel_misc_grid")); 329 misc.add (drawgridCheck); 330 drawperimeterCheck = new JCheckBox ((String)cc.rb.getObject ("options_OptionsDialog_drawPanel_misc_perimeter")); 331 misc.add (drawperimeterCheck); 332 drawrectCheck = new JCheckBox ((String)cc.rb.getObject ("options_OptionsDialog_drawPanel_misc_rectangular")); 333 misc.add (drawrectCheck); 334 drawcoordsCheck = new JCheckBox ((String)cc.rb.getObject ("options_OptionsDialog_drawPanel_edit_drawcoords")); 335 misc.add (drawcoordsCheck); 336 draworimarkerCheck = new JCheckBox ((String)cc.rb.getObject ("options_OptionsDialog_drawPanel_edit_draworientationmarkers")); 337 misc.add (draworimarkerCheck); 338 // edit 339 JPanel edit = new JPanel (); 340 GridBagLayout editlayout = new GridBagLayout (); 341 GridBagConstraints editconstraints = new GridBagConstraints (); 342 edit.setLayout (editlayout); 343 editconstraints.fill = GridBagConstraints.HORIZONTAL; 344 editconstraints.weightx = 1.0; 345 edit.setBorder (BorderFactory.createTitledBorder ((String)cc.rb.getObject("options_OptionsDialog_drawPanel_edit_header"))); 346 snapCheck = new JCheckBox ((String)cc.rb.getObject ("options_OptionsDialog_drawPanel_edit_snapon")); 347 snapCheck.addActionListener (actionlistener); 348 snapCheck.setActionCommand (OptionsActionListener.SNAP); 349 editconstraints.gridy = 0; 350 editconstraints.gridx = 0; 351 editlayout.setConstraints(snapCheck, editconstraints); 352 edit.add (snapCheck); 353 JLabel snapx = new JLabel ((String)cc.rb.getObject ("options_OptionsDialog_drawPanel_edit_snapx")); 354 editconstraints.gridy = 1; 355 editconstraints.gridx = 1; 356 editlayout.setConstraints(snapx, editconstraints); 357 edit.add (snapx); 358 snapXTF = new JTextField (5); 359 editconstraints.gridx = 2; 360 editlayout.setConstraints(snapXTF, editconstraints); 361 edit.add (snapXTF); 362 JLabel snapy = new JLabel ((String)cc.rb.getObject ("options_OptionsDialog_drawPanel_edit_snapy")); 363 editconstraints.gridy = 2; 364 editconstraints.gridx = 1; 365 editlayout.setConstraints(snapy, editconstraints); 366 edit.add (snapy); 367 snapYTF = new JTextField (5); 368 editconstraints.gridx = 2; 369 editlayout.setConstraints(snapYTF, editconstraints); 370 edit.add (snapYTF); 371 JLabel tolLabel = new JLabel ((String)cc.rb.getObject ("options_OptionsDialog_drawPanel_edit_tolerance")); 372 editconstraints.gridy = 3; 373 editconstraints.gridx = 0; 374 editlayout.setConstraints(tolLabel, editconstraints); 375 edit.add (tolLabel); 376 toleranceTF = new JTextField (5); 377 editconstraints.gridx = 1; 378 editlayout.setConstraints(toleranceTF, editconstraints); 379 edit.add (toleranceTF); 380 JLabel epsilonLabel = new JLabel ((String)cc.rb.getObject ("options_OptionsDialog_drawPanel_edit_epsilon")); 381 editconstraints.gridy = 4; 382 editconstraints.gridx = 0; 383 editlayout.setConstraints(epsilonLabel, editconstraints); 384 edit.add (epsilonLabel); 385 epsilonSlider = new JSlider(JSlider.HORIZONTAL, 0, 100, 33); 386 Hashtable sliderlabels = new Hashtable(); 387 sliderlabels.put( new Integer( 1 ), new JLabel((String)cc.rb.getObject("options_OptionsDialog_drawPanel_edit_epsilon_sliderlow") )); 388 sliderlabels.put( new Integer( 50 ), new JLabel((String)cc.rb.getObject("options_OptionsDialog_drawPanel_edit_epsilon_slidermedium")) ); 389 sliderlabels.put( new Integer( 99 ), new JLabel((String)cc.rb.getObject("options_OptionsDialog_drawPanel_edit_epsilon_sliderhigh") )); 390 epsilonSlider.setMajorTickSpacing(20); 391 epsilonSlider.setMinorTickSpacing(10); 392 epsilonSlider.setPaintTicks(true); 393 epsilonSlider.setPaintLabels(true); 394 epsilonSlider.setLabelTable (sliderlabels); 395 epsilonSlider.setBorder(BorderFactory.createEmptyBorder(0,0,5,0)); 396 editconstraints.gridy = 5; 397 editconstraints.gridx = 1; 398 editconstraints.gridwidth = 3; 399 editlayout.setConstraints(epsilonSlider, editconstraints); 400 edit.add (epsilonSlider); 401 // add all boxes in logical order 402 constraints.gridy = 0; 403 layout.setConstraints(boundary, constraints); 404 drawPanel.add (boundary); 405 constraints.gridx = 1; 406 layout.setConstraints(node, constraints); 407 drawPanel.add (node); 408 constraints.gridy = 1; 409 constraints.gridx = 0; 410 layout.setConstraints(edge, constraints); 411 drawPanel.add (edge); 412 constraints.gridx = 1; 413 layout.setConstraints(element, constraints); 414 drawPanel.add (element); 415 constraints.gridy = 2; 416 constraints.gridx = 0; 417 layout.setConstraints(misc, constraints); 418 drawPanel.add (misc); 419 constraints.gridx = 1; 420 layout.setConstraints (edit, constraints); 421 drawPanel.add (edit); 422 tabs.addTab ((String)cc.rb.getObject ("options_OptionsDialog_drawPanel_tabheader"),null,drawPanel,(String)cc.rb.getObject ("options_OptionsDialog_drawPanel_tabheader_tooltip")); 423 } 424 425 /** creates the GUI for the COLOR tab */ initColorPanel()426 private void initColorPanel () 427 { 428 colorPanel = new JPanel (); 429 colorPanel.setBorder (new EmptyBorder (10,10,10,10)); 430 JLabel label; 431 JButton button; 432 // layoutmanager for the whole tab 433 GridBagLayout layout = new GridBagLayout (); 434 GridBagConstraints constraints = new GridBagConstraints (); 435 colorPanel.setLayout (layout); 436 constraints.fill = GridBagConstraints.BOTH; 437 constraints.weightx = 1.0; 438 constraints.weighty = 1.0; 439 // layoutmanager for each panel 440 GridBagLayout panellayout = new GridBagLayout (); 441 GridBagConstraints panelconstraints = new GridBagConstraints (); 442 panelconstraints.insets = new Insets (0,15,3,15); 443 // objects - nodes 444 JPanel objects = new JPanel (); 445 objects.setLayout (panellayout); 446 objects.setBorder (BorderFactory.createTitledBorder((String)cc.rb.getObject ("options_OptionsDialog_colorPanel_objects_header"))); 447 panelconstraints.gridy = 0; 448 label = new JLabel ((String)cc.rb.getObject ("options_OptionsDialog_colorPanel_objects_node")); 449 panelconstraints.gridx = 0; 450 panellayout.setConstraints(label, panelconstraints); 451 objects.add (label); 452 colornodeLabel = new JLabel (); 453 colornodeLabel.setPreferredSize (new Dimension (50,24)); 454 colornodeLabel.setOpaque (true); 455 colornodeLabel.setBorder (BorderFactory.createLineBorder (Color.black)); 456 panelconstraints.gridx = 1; 457 panellayout.setConstraints(colornodeLabel, panelconstraints); 458 objects.add (colornodeLabel); 459 button = new JButton ("..."); 460 button.addActionListener (actionlistener); 461 button.setActionCommand (OptionsActionListener.COLORNODE); 462 panelconstraints.gridx = 2; 463 panellayout.setConstraints(button, panelconstraints); 464 objects.add (button); 465 // objects edges 466 panelconstraints.gridy = 1; 467 label = new JLabel ((String)cc.rb.getObject ("options_OptionsDialog_colorPanel_objects_edge")); 468 panelconstraints.gridx = 0; 469 panellayout.setConstraints(label, panelconstraints); 470 objects.add (label); 471 coloredgeLabel = new JLabel (); 472 coloredgeLabel.setPreferredSize (new Dimension (50,24)); 473 coloredgeLabel.setOpaque (true); 474 coloredgeLabel.setBorder (BorderFactory.createLineBorder (Color.black)); 475 panelconstraints.gridx = 1; 476 panellayout.setConstraints(coloredgeLabel, panelconstraints); 477 objects.add (coloredgeLabel); 478 button = new JButton ("..."); 479 button.addActionListener (actionlistener); 480 button.setActionCommand (OptionsActionListener.COLOREDGE); 481 panelconstraints.gridx = 2; 482 panellayout.setConstraints(button, panelconstraints); 483 objects.add (button); 484 // objects edgebase 485 panelconstraints.gridy = 2; 486 label = new JLabel ((String)cc.rb.getObject ("options_OptionsDialog_colorPanel_objects_edgebase")); 487 panelconstraints.gridx = 0; 488 panellayout.setConstraints(label, panelconstraints); 489 objects.add (label); 490 coloredgebaseLabel = new JLabel (); 491 coloredgebaseLabel.setPreferredSize (new Dimension (50,24)); 492 coloredgebaseLabel.setOpaque (true); 493 coloredgebaseLabel.setBorder (BorderFactory.createLineBorder (Color.black)); 494 panelconstraints.gridx = 1; 495 panellayout.setConstraints(coloredgebaseLabel, panelconstraints); 496 objects.add (coloredgebaseLabel); 497 button = new JButton ("..."); 498 button.addActionListener (actionlistener); 499 button.setActionCommand (OptionsActionListener.COLOREDGEBASE); 500 panelconstraints.gridx = 2; 501 panellayout.setConstraints(button, panelconstraints); 502 objects.add (button); 503 504 // objects - elements 505 panelconstraints.gridy = 3; 506 label = new JLabel ((String)cc.rb.getObject ("options_OptionsDialog_colorPanel_objects_element")); 507 panelconstraints.gridx = 0; 508 panellayout.setConstraints(label, panelconstraints); 509 objects.add (label); 510 colorelementLabel = new JLabel (); 511 colorelementLabel.setPreferredSize (new Dimension (50,24)); 512 colorelementLabel.setOpaque (true); 513 colorelementLabel.setBorder (BorderFactory.createLineBorder (Color.black)); 514 panelconstraints.gridx = 1; 515 panellayout.setConstraints(colorelementLabel, panelconstraints); 516 objects.add (colorelementLabel); 517 button = new JButton ("..."); 518 button.addActionListener (actionlistener); 519 button.setActionCommand (OptionsActionListener.COLORELEMENT); 520 panelconstraints.gridx = 2; 521 panellayout.setConstraints(button, panelconstraints); 522 objects.add (button); 523 constraints.gridy = 0; 524 constraints.gridx = 0; 525 layout.setConstraints(objects, constraints); 526 colorPanel.add (objects); 527 // numbers - boundary 528 JPanel numbers = new JPanel (); 529 numbers.setLayout (panellayout); 530 numbers.setBorder (BorderFactory.createTitledBorder((String)cc.rb.getObject ("options_OptionsDialog_colorPanel_numbers_header"))); 531 label = new JLabel ((String)cc.rb.getObject ("options_OptionsDialog_colorPanel_numbers_boundary")); 532 panelconstraints.gridx = 0; 533 panelconstraints.gridy = 0; 534 panellayout.setConstraints(label, panelconstraints); 535 numbers.add (label); 536 numberboundaryLabel = new JLabel (); 537 numberboundaryLabel.setPreferredSize (new Dimension (50,24)); 538 numberboundaryLabel.setOpaque (true); 539 numberboundaryLabel.setBorder (BorderFactory.createLineBorder (Color.black)); 540 panelconstraints.gridx = 1; 541 panellayout.setConstraints(numberboundaryLabel, panelconstraints); 542 numbers.add (numberboundaryLabel); 543 button = new JButton ("..."); 544 button.addActionListener (actionlistener); 545 button.setActionCommand (OptionsActionListener.NUMBERBOUNDARY); 546 panelconstraints.gridx = 2; 547 panellayout.setConstraints(button, panelconstraints); 548 numbers.add (button); 549 // numbers - nodes 550 panelconstraints.gridy = 1; 551 label = new JLabel ((String)cc.rb.getObject ("options_OptionsDialog_colorPanel_numbers_node")); 552 panelconstraints.gridx = 0; 553 panellayout.setConstraints(label, panelconstraints); 554 numbers.add (label); 555 numbernodeLabel = new JLabel (); 556 numbernodeLabel.setPreferredSize (new Dimension (50,24)); 557 numbernodeLabel.setOpaque (true); 558 numbernodeLabel.setBorder (BorderFactory.createLineBorder (Color.black)); 559 panelconstraints.gridx = 1; 560 panellayout.setConstraints(numbernodeLabel, panelconstraints); 561 numbers.add (numbernodeLabel); 562 button = new JButton ("..."); 563 button.addActionListener (actionlistener); 564 button.setActionCommand (OptionsActionListener.NUMBERNODE); 565 panelconstraints.gridx = 2; 566 panellayout.setConstraints(button, panelconstraints); 567 numbers.add (button); 568 // numbers - edges 569 panelconstraints.gridy = 2; 570 label = new JLabel ((String)cc.rb.getObject ("options_OptionsDialog_colorPanel_numbers_edge")); 571 panelconstraints.gridx = 0; 572 panellayout.setConstraints(label, panelconstraints); 573 numbers.add (label); 574 numberedgeLabel = new JLabel (); 575 numberedgeLabel.setPreferredSize (new Dimension (50,24)); 576 numberedgeLabel.setOpaque (true); 577 numberedgeLabel.setBorder (BorderFactory.createLineBorder (Color.black)); 578 panelconstraints.gridx = 1; 579 panellayout.setConstraints(numberedgeLabel, panelconstraints); 580 numbers.add (numberedgeLabel); 581 button = new JButton ("..."); 582 button.addActionListener (actionlistener); 583 button.setActionCommand (OptionsActionListener.NUMBEREDGE); 584 panelconstraints.gridx = 2; 585 panellayout.setConstraints(button, panelconstraints); 586 numbers.add (button); 587 // numbers - elements 588 panelconstraints.gridy = 3; 589 label = new JLabel ((String)cc.rb.getObject ("options_OptionsDialog_colorPanel_numbers_element")); 590 panelconstraints.gridx = 0; 591 panellayout.setConstraints(label, panelconstraints); 592 numbers.add (label); 593 numberelementLabel = new JLabel (); 594 numberelementLabel.setPreferredSize (new Dimension (50,24)); 595 numberelementLabel.setOpaque (true); 596 numberelementLabel.setBorder (BorderFactory.createLineBorder (Color.black)); 597 panelconstraints.gridx = 1; 598 panellayout.setConstraints(numberelementLabel, panelconstraints); 599 numbers.add (numberelementLabel); 600 button = new JButton ("..."); 601 button.addActionListener (actionlistener); 602 button.setActionCommand (OptionsActionListener.NUMBERELEMENT); 603 panelconstraints.gridx = 2; 604 panellayout.setConstraints(button, panelconstraints); 605 numbers.add (button); 606 constraints.gridy = 0; 607 constraints.gridx = 1; 608 layout.setConstraints(numbers, constraints); 609 colorPanel.add (numbers); 610 // fillcolor palette 611 JPanel fill = new JPanel (); 612 fill.setLayout (panellayout); 613 fill.setBorder (BorderFactory.createTitledBorder((String)cc.rb.getObject ("options_OptionsDialog_colorPanel_fill_header"))); 614 panelconstraints.gridx = 0; 615 panelconstraints.gridy = 0; 616 panelconstraints.insets = new Insets (0,0,0,0); 617 constraints.gridwidth = 2; 618 fill0Label = new JLabel (); 619 fill0Label.setPreferredSize (new Dimension (24,24)); 620 fill0Label.setOpaque (true); 621 fill0Label.setBorder (BorderFactory.createLineBorder (Color.black)); 622 panellayout.setConstraints(fill0Label, panelconstraints); 623 fill.add (fill0Label); 624 panelconstraints.gridx = 1; 625 fill1Label = new JLabel (); 626 fill1Label.setPreferredSize (new Dimension (24,24)); 627 fill1Label.setOpaque (true); 628 fill1Label.setBorder (BorderFactory.createLineBorder (Color.black)); 629 panellayout.setConstraints(fill1Label, panelconstraints); 630 fill.add (fill1Label); 631 panelconstraints.gridx = 2; 632 fill2Label = new JLabel (); 633 fill2Label.setPreferredSize (new Dimension (24,24)); 634 fill2Label.setOpaque (true); 635 fill2Label.setBorder (BorderFactory.createLineBorder (Color.black)); 636 panellayout.setConstraints(fill2Label, panelconstraints); 637 fill.add (fill2Label); 638 panelconstraints.gridx = 3; 639 fill3Label = new JLabel (); 640 fill3Label.setPreferredSize (new Dimension (24,24)); 641 fill3Label.setOpaque (true); 642 fill3Label.setBorder (BorderFactory.createLineBorder (Color.black)); 643 panellayout.setConstraints(fill3Label, panelconstraints); 644 fill.add (fill3Label); 645 panelconstraints.gridx = 4; 646 fill4Label = new JLabel (); 647 fill4Label.setPreferredSize (new Dimension (24,24)); 648 fill4Label.setOpaque (true); 649 fill4Label.setBorder (BorderFactory.createLineBorder (Color.black)); 650 panellayout.setConstraints(fill4Label, panelconstraints); 651 fill.add (fill4Label); 652 panelconstraints.gridx = 5; 653 fill5Label = new JLabel (); 654 fill5Label.setPreferredSize (new Dimension (24,24)); 655 fill5Label.setOpaque (true); 656 fill5Label.setBorder (BorderFactory.createLineBorder (Color.black)); 657 panellayout.setConstraints(fill5Label, panelconstraints); 658 fill.add (fill5Label); 659 panelconstraints.gridx = 6; 660 fill6Label = new JLabel (); 661 fill6Label.setPreferredSize (new Dimension (24,24)); 662 fill6Label.setOpaque (true); 663 fill6Label.setBorder (BorderFactory.createLineBorder (Color.black)); 664 panellayout.setConstraints(fill6Label, panelconstraints); 665 fill.add (fill6Label); 666 panelconstraints.gridx = 7; 667 fill7Label = new JLabel (); 668 fill7Label.setPreferredSize (new Dimension (24,24)); 669 fill7Label.setOpaque (true); 670 fill7Label.setBorder (BorderFactory.createLineBorder (Color.black)); 671 panellayout.setConstraints(fill7Label, panelconstraints); 672 fill.add (fill7Label); 673 panelconstraints.gridx = 8; 674 fill8Label = new JLabel (); 675 fill8Label.setPreferredSize (new Dimension (24,24)); 676 fill8Label.setOpaque (true); 677 fill8Label.setBorder (BorderFactory.createLineBorder (Color.black)); 678 panellayout.setConstraints(fill8Label, panelconstraints); 679 fill.add (fill8Label); 680 panelconstraints.gridx = 9; 681 fill9Label = new JLabel (); 682 fill9Label.setPreferredSize (new Dimension (24,24)); 683 fill9Label.setOpaque (true); 684 fill9Label.setBorder (BorderFactory.createLineBorder (Color.black)); 685 panellayout.setConstraints(fill9Label, panelconstraints); 686 fill.add (fill9Label); 687 panelconstraints.gridx = 10; 688 fill10Label = new JLabel (); 689 fill10Label.setPreferredSize (new Dimension (24,24)); 690 fill10Label.setOpaque (true); 691 fill10Label.setBorder (BorderFactory.createLineBorder (Color.black)); 692 panellayout.setConstraints(fill10Label, panelconstraints); 693 fill.add (fill10Label); 694 panelconstraints.gridx = 11; 695 fill11Label = new JLabel (); 696 fill11Label.setPreferredSize (new Dimension (24,24)); 697 fill11Label.setOpaque (true); 698 fill11Label.setBorder (BorderFactory.createLineBorder (Color.black)); 699 panellayout.setConstraints(fill11Label, panelconstraints); 700 fill.add (fill11Label); 701 panelconstraints.gridx = 12; 702 fill12Label = new JLabel (); 703 fill12Label.setPreferredSize (new Dimension (24,24)); 704 fill12Label.setOpaque (true); 705 fill12Label.setBorder (BorderFactory.createLineBorder (Color.black)); 706 panellayout.setConstraints(fill12Label, panelconstraints); 707 fill.add (fill12Label); 708 panelconstraints.gridx = 13; 709 fill13Label = new JLabel (); 710 fill13Label.setPreferredSize (new Dimension (24,24)); 711 fill13Label.setOpaque (true); 712 fill13Label.setBorder (BorderFactory.createLineBorder (Color.black)); 713 panellayout.setConstraints(fill13Label, panelconstraints); 714 fill.add (fill13Label); 715 panelconstraints.gridx = 14; 716 fill14Label = new JLabel (); 717 fill14Label.setPreferredSize (new Dimension (24,24)); 718 fill14Label.setOpaque (true); 719 fill14Label.setBorder (BorderFactory.createLineBorder (Color.black)); 720 panellayout.setConstraints(fill14Label, panelconstraints); 721 fill.add (fill14Label); 722 panelconstraints.gridx = 15; 723 fill15Label = new JLabel (); 724 fill15Label.setPreferredSize (new Dimension (24,24)); 725 fill15Label.setOpaque (true); 726 fill15Label.setBorder (BorderFactory.createLineBorder (Color.black)); 727 panellayout.setConstraints(fill15Label, panelconstraints); 728 fill.add (fill15Label); 729 panelconstraints.gridy = 1; 730 button = new JButton ("..."); 731 button.addActionListener (actionlistener); 732 button.setActionCommand (OptionsActionListener.FILL0); 733 button.setPreferredSize (new Dimension (26,26)); 734 panelconstraints.gridx = 0; 735 panellayout.setConstraints(button, panelconstraints); 736 fill.add (button); 737 button = new JButton ("..."); 738 button.addActionListener (actionlistener); 739 button.setActionCommand (OptionsActionListener.FILL1); 740 button.setPreferredSize (new Dimension (26,26)); 741 panelconstraints.gridx = 1; 742 panellayout.setConstraints(button, panelconstraints); 743 fill.add (button); 744 button = new JButton ("..."); 745 button.addActionListener (actionlistener); 746 button.setActionCommand (OptionsActionListener.FILL2); 747 button.setPreferredSize (new Dimension (26,26)); 748 panelconstraints.gridx = 2; 749 panellayout.setConstraints(button, panelconstraints); 750 fill.add (button); 751 button = new JButton ("..."); 752 button.addActionListener (actionlistener); 753 button.setActionCommand (OptionsActionListener.FILL3); 754 button.setPreferredSize (new Dimension (26,26)); 755 panelconstraints.gridx = 3; 756 panellayout.setConstraints(button, panelconstraints); 757 fill.add (button); 758 button = new JButton ("..."); 759 button.addActionListener (actionlistener); 760 button.setActionCommand (OptionsActionListener.FILL4); 761 button.setPreferredSize (new Dimension (26,26)); 762 panelconstraints.gridx = 4; 763 panellayout.setConstraints(button, panelconstraints); 764 fill.add (button); 765 button = new JButton ("..."); 766 button.addActionListener (actionlistener); 767 button.setActionCommand (OptionsActionListener.FILL5); 768 button.setPreferredSize (new Dimension (26,26)); 769 panelconstraints.gridx = 5; 770 panellayout.setConstraints(button, panelconstraints); 771 fill.add (button); 772 button = new JButton ("..."); 773 button.addActionListener (actionlistener); 774 button.setActionCommand (OptionsActionListener.FILL6); 775 button.setPreferredSize (new Dimension (26,26)); 776 panelconstraints.gridx = 6; 777 panellayout.setConstraints(button, panelconstraints); 778 fill.add (button); 779 button = new JButton ("..."); 780 button.addActionListener (actionlistener); 781 button.setActionCommand (OptionsActionListener.FILL7); 782 button.setPreferredSize (new Dimension (26,26)); 783 panelconstraints.gridx = 7; 784 panellayout.setConstraints(button, panelconstraints); 785 fill.add (button); 786 button = new JButton ("..."); 787 button.addActionListener (actionlistener); 788 button.setActionCommand (OptionsActionListener.FILL8); 789 button.setPreferredSize (new Dimension (26,26)); 790 panelconstraints.gridx = 8; 791 panellayout.setConstraints(button, panelconstraints); 792 fill.add (button); 793 button = new JButton ("..."); 794 button.addActionListener (actionlistener); 795 button.setActionCommand (OptionsActionListener.FILL9); 796 button.setPreferredSize (new Dimension (26,26)); 797 panelconstraints.gridx = 9; 798 panellayout.setConstraints(button, panelconstraints); 799 fill.add (button); 800 button = new JButton ("..."); 801 button.addActionListener (actionlistener); 802 button.setActionCommand (OptionsActionListener.FILL10); 803 button.setPreferredSize (new Dimension (26,26)); 804 panelconstraints.gridx = 10; 805 panellayout.setConstraints(button, panelconstraints); 806 fill.add (button); 807 button = new JButton ("..."); 808 button.addActionListener (actionlistener); 809 button.setActionCommand (OptionsActionListener.FILL11); 810 button.setPreferredSize (new Dimension (26,26)); 811 panelconstraints.gridx = 11; 812 panellayout.setConstraints(button, panelconstraints); 813 fill.add (button); 814 button = new JButton ("..."); 815 button.addActionListener (actionlistener); 816 button.setActionCommand (OptionsActionListener.FILL12); 817 button.setPreferredSize (new Dimension (26,26)); 818 panelconstraints.gridx = 12; 819 panellayout.setConstraints(button, panelconstraints); 820 fill.add (button); 821 button = new JButton ("..."); 822 button.addActionListener (actionlistener); 823 button.setActionCommand (OptionsActionListener.FILL13); 824 button.setPreferredSize (new Dimension (26,26)); 825 panelconstraints.gridx = 13; 826 panellayout.setConstraints(button, panelconstraints); 827 fill.add (button); 828 button = new JButton ("..."); 829 button.addActionListener (actionlistener); 830 button.setActionCommand (OptionsActionListener.FILL14); 831 button.setPreferredSize (new Dimension (26,26)); 832 panelconstraints.gridx = 14; 833 panellayout.setConstraints(button, panelconstraints); 834 fill.add (button); 835 button = new JButton ("..."); 836 button.addActionListener (actionlistener); 837 button.setActionCommand (OptionsActionListener.FILL15); 838 button.setPreferredSize (new Dimension (26,26)); 839 panelconstraints.gridx = 15; 840 panellayout.setConstraints(button, panelconstraints); 841 fill.add (button); 842 constraints.gridy = 1; 843 constraints.gridx = 0; 844 constraints.gridwidth = 2; 845 layout.setConstraints(fill, constraints); 846 colorPanel.add (fill); 847 848 // boundarycolor palette 849 JPanel bound = new JPanel (); 850 bound.setLayout (panellayout); 851 bound.setBorder (BorderFactory.createTitledBorder((String)cc.rb.getObject ("options_OptionsDialog_colorPanel_boundarypalette_header"))); 852 panelconstraints.gridx = 0; 853 panelconstraints.gridy = 0; 854 panelconstraints.insets = new Insets (0,0,0,0); 855 constraints.gridwidth = 2; 856 bound0Label = new JLabel (); 857 bound0Label.setPreferredSize (new Dimension (24,24)); 858 bound0Label.setOpaque (true); 859 bound0Label.setBorder (BorderFactory.createLineBorder (Color.black)); 860 panellayout.setConstraints(bound0Label, panelconstraints); 861 bound.add (bound0Label); 862 panelconstraints.gridx = 1; 863 bound1Label = new JLabel (); 864 bound1Label.setPreferredSize (new Dimension (24,24)); 865 bound1Label.setOpaque (true); 866 bound1Label.setBorder (BorderFactory.createLineBorder (Color.black)); 867 panellayout.setConstraints(bound1Label, panelconstraints); 868 bound.add (bound1Label); 869 panelconstraints.gridx = 2; 870 bound2Label = new JLabel (); 871 bound2Label.setPreferredSize (new Dimension (24,24)); 872 bound2Label.setOpaque (true); 873 bound2Label.setBorder (BorderFactory.createLineBorder (Color.black)); 874 panellayout.setConstraints(bound2Label, panelconstraints); 875 bound.add (bound2Label); 876 panelconstraints.gridx = 3; 877 bound3Label = new JLabel (); 878 bound3Label.setPreferredSize (new Dimension (24,24)); 879 bound3Label.setOpaque (true); 880 bound3Label.setBorder (BorderFactory.createLineBorder (Color.black)); 881 panellayout.setConstraints(bound3Label, panelconstraints); 882 bound.add (bound3Label); 883 panelconstraints.gridx = 4; 884 bound4Label = new JLabel (); 885 bound4Label.setPreferredSize (new Dimension (24,24)); 886 bound4Label.setOpaque (true); 887 bound4Label.setBorder (BorderFactory.createLineBorder (Color.black)); 888 panellayout.setConstraints(bound4Label, panelconstraints); 889 bound.add (bound4Label); 890 panelconstraints.gridx = 5; 891 bound5Label = new JLabel (); 892 bound5Label.setPreferredSize (new Dimension (24,24)); 893 bound5Label.setOpaque (true); 894 bound5Label.setBorder (BorderFactory.createLineBorder (Color.black)); 895 panellayout.setConstraints(bound5Label, panelconstraints); 896 bound.add (bound5Label); 897 panelconstraints.gridx = 6; 898 bound6Label = new JLabel (); 899 bound6Label.setPreferredSize (new Dimension (24,24)); 900 bound6Label.setOpaque (true); 901 bound6Label.setBorder (BorderFactory.createLineBorder (Color.black)); 902 panellayout.setConstraints(bound6Label, panelconstraints); 903 bound.add (bound6Label); 904 panelconstraints.gridx = 7; 905 bound7Label = new JLabel (); 906 bound7Label.setPreferredSize (new Dimension (24,24)); 907 bound7Label.setOpaque (true); 908 bound7Label.setBorder (BorderFactory.createLineBorder (Color.black)); 909 panellayout.setConstraints(bound7Label, panelconstraints); 910 bound.add (bound7Label); 911 panelconstraints.gridx = 8; 912 bound8Label = new JLabel (); 913 bound8Label.setPreferredSize (new Dimension (24,24)); 914 bound8Label.setOpaque (true); 915 bound8Label.setBorder (BorderFactory.createLineBorder (Color.black)); 916 panellayout.setConstraints(bound8Label, panelconstraints); 917 bound.add (bound8Label); 918 panelconstraints.gridx = 9; 919 bound9Label = new JLabel (); 920 bound9Label.setPreferredSize (new Dimension (24,24)); 921 bound9Label.setOpaque (true); 922 bound9Label.setBorder (BorderFactory.createLineBorder (Color.black)); 923 panellayout.setConstraints(bound9Label, panelconstraints); 924 bound.add (bound9Label); 925 panelconstraints.gridx = 10; 926 bound10Label = new JLabel (); 927 bound10Label.setPreferredSize (new Dimension (24,24)); 928 bound10Label.setOpaque (true); 929 bound10Label.setBorder (BorderFactory.createLineBorder (Color.black)); 930 panellayout.setConstraints(bound10Label, panelconstraints); 931 bound.add (bound10Label); 932 panelconstraints.gridx = 11; 933 bound11Label = new JLabel (); 934 bound11Label.setPreferredSize (new Dimension (24,24)); 935 bound11Label.setOpaque (true); 936 bound11Label.setBorder (BorderFactory.createLineBorder (Color.black)); 937 panellayout.setConstraints(bound11Label, panelconstraints); 938 bound.add (bound11Label); 939 panelconstraints.gridx = 12; 940 bound12Label = new JLabel (); 941 bound12Label.setPreferredSize (new Dimension (24,24)); 942 bound12Label.setOpaque (true); 943 bound12Label.setBorder (BorderFactory.createLineBorder (Color.black)); 944 panellayout.setConstraints(bound12Label, panelconstraints); 945 bound.add (bound12Label); 946 panelconstraints.gridx = 13; 947 bound13Label = new JLabel (); 948 bound13Label.setPreferredSize (new Dimension (24,24)); 949 bound13Label.setOpaque (true); 950 bound13Label.setBorder (BorderFactory.createLineBorder (Color.black)); 951 panellayout.setConstraints(bound13Label, panelconstraints); 952 bound.add (bound13Label); 953 panelconstraints.gridx = 14; 954 bound14Label = new JLabel (); 955 bound14Label.setPreferredSize (new Dimension (24,24)); 956 bound14Label.setOpaque (true); 957 bound14Label.setBorder (BorderFactory.createLineBorder (Color.black)); 958 panellayout.setConstraints(bound14Label, panelconstraints); 959 bound.add (bound14Label); 960 panelconstraints.gridx = 15; 961 bound15Label = new JLabel (); 962 bound15Label.setPreferredSize (new Dimension (24,24)); 963 bound15Label.setOpaque (true); 964 bound15Label.setBorder (BorderFactory.createLineBorder (Color.black)); 965 panellayout.setConstraints(bound15Label, panelconstraints); 966 bound.add (bound15Label); 967 panelconstraints.gridy = 1; 968 button = new JButton ("..."); 969 button.addActionListener (actionlistener); 970 button.setActionCommand (OptionsActionListener.BOUND0); 971 button.setPreferredSize (new Dimension (26,26)); 972 panelconstraints.gridx = 0; 973 panellayout.setConstraints(button, panelconstraints); 974 bound.add (button); 975 button = new JButton ("..."); 976 button.addActionListener (actionlistener); 977 button.setActionCommand (OptionsActionListener.BOUND1); 978 button.setPreferredSize (new Dimension (26,26)); 979 panelconstraints.gridx = 1; 980 panellayout.setConstraints(button, panelconstraints); 981 bound.add (button); 982 button = new JButton ("..."); 983 button.addActionListener (actionlistener); 984 button.setActionCommand (OptionsActionListener.BOUND2); 985 button.setPreferredSize (new Dimension (26,26)); 986 panelconstraints.gridx = 2; 987 panellayout.setConstraints(button, panelconstraints); 988 bound.add (button); 989 button = new JButton ("..."); 990 button.addActionListener (actionlistener); 991 button.setActionCommand (OptionsActionListener.BOUND3); 992 button.setPreferredSize (new Dimension (26,26)); 993 panelconstraints.gridx = 3; 994 panellayout.setConstraints(button, panelconstraints); 995 bound.add (button); 996 button = new JButton ("..."); 997 button.addActionListener (actionlistener); 998 button.setActionCommand (OptionsActionListener.BOUND4); 999 button.setPreferredSize (new Dimension (26,26)); 1000 panelconstraints.gridx = 4; 1001 panellayout.setConstraints(button, panelconstraints); 1002 bound.add (button); 1003 button = new JButton ("..."); 1004 button.addActionListener (actionlistener); 1005 button.setActionCommand (OptionsActionListener.BOUND5); 1006 button.setPreferredSize (new Dimension (26,26)); 1007 panelconstraints.gridx = 5; 1008 panellayout.setConstraints(button, panelconstraints); 1009 bound.add (button); 1010 button = new JButton ("..."); 1011 button.addActionListener (actionlistener); 1012 button.setActionCommand (OptionsActionListener.BOUND6); 1013 button.setPreferredSize (new Dimension (26,26)); 1014 panelconstraints.gridx = 6; 1015 panellayout.setConstraints(button, panelconstraints); 1016 bound.add (button); 1017 button = new JButton ("..."); 1018 button.addActionListener (actionlistener); 1019 button.setActionCommand (OptionsActionListener.BOUND7); 1020 button.setPreferredSize (new Dimension (26,26)); 1021 panelconstraints.gridx = 7; 1022 panellayout.setConstraints(button, panelconstraints); 1023 bound.add (button); 1024 button = new JButton ("..."); 1025 button.addActionListener (actionlistener); 1026 button.setActionCommand (OptionsActionListener.BOUND8); 1027 button.setPreferredSize (new Dimension (26,26)); 1028 panelconstraints.gridx = 8; 1029 panellayout.setConstraints(button, panelconstraints); 1030 bound.add (button); 1031 button = new JButton ("..."); 1032 button.addActionListener (actionlistener); 1033 button.setActionCommand (OptionsActionListener.BOUND9); 1034 button.setPreferredSize (new Dimension (26,26)); 1035 panelconstraints.gridx = 9; 1036 panellayout.setConstraints(button, panelconstraints); 1037 bound.add (button); 1038 button = new JButton ("..."); 1039 button.addActionListener (actionlistener); 1040 button.setActionCommand (OptionsActionListener.BOUND10); 1041 button.setPreferredSize (new Dimension (26,26)); 1042 panelconstraints.gridx = 10; 1043 panellayout.setConstraints(button, panelconstraints); 1044 bound.add (button); 1045 button = new JButton ("..."); 1046 button.addActionListener (actionlistener); 1047 button.setActionCommand (OptionsActionListener.BOUND11); 1048 button.setPreferredSize (new Dimension (26,26)); 1049 panelconstraints.gridx = 11; 1050 panellayout.setConstraints(button, panelconstraints); 1051 bound.add (button); 1052 button = new JButton ("..."); 1053 button.addActionListener (actionlistener); 1054 button.setActionCommand (OptionsActionListener.BOUND12); 1055 button.setPreferredSize (new Dimension (26,26)); 1056 panelconstraints.gridx = 12; 1057 panellayout.setConstraints(button, panelconstraints); 1058 bound.add (button); 1059 button = new JButton ("..."); 1060 button.addActionListener (actionlistener); 1061 button.setActionCommand (OptionsActionListener.BOUND13); 1062 button.setPreferredSize (new Dimension (26,26)); 1063 panelconstraints.gridx = 13; 1064 panellayout.setConstraints(button, panelconstraints); 1065 bound.add (button); 1066 button = new JButton ("..."); 1067 button.addActionListener (actionlistener); 1068 button.setActionCommand (OptionsActionListener.BOUND14); 1069 button.setPreferredSize (new Dimension (26,26)); 1070 panelconstraints.gridx = 14; 1071 panellayout.setConstraints(button, panelconstraints); 1072 bound.add (button); 1073 button = new JButton ("..."); 1074 button.addActionListener (actionlistener); 1075 button.setActionCommand (OptionsActionListener.BOUND15); 1076 button.setPreferredSize (new Dimension (26,26)); 1077 panelconstraints.gridx = 15; 1078 panellayout.setConstraints(button, panelconstraints); 1079 bound.add (button); 1080 constraints.gridy = 2; 1081 constraints.gridx = 0; 1082 constraints.gridwidth = 2; 1083 layout.setConstraints(bound, constraints); 1084 colorPanel.add (bound); 1085 1086 // highlight - selection 1087 1088 panelconstraints.insets = new Insets (0,15,3,15); 1089 JPanel highlight = new JPanel (); 1090 highlight.setLayout (panellayout); 1091 highlight.setBorder (BorderFactory.createTitledBorder((String)cc.rb.getObject ("options_OptionsDialog_colorPanel_highlight_header"))); 1092 label = new JLabel ((String)cc.rb.getObject ("options_OptionsDialog_colorPanel_highlight_selection")); 1093 panelconstraints.gridx = 0; 1094 panelconstraints.gridy = 0; 1095 panellayout.setConstraints(label, panelconstraints); 1096 highlight.add (label); 1097 highlightselectionLabel = new JLabel (); 1098 highlightselectionLabel.setPreferredSize (new Dimension (50,24)); 1099 highlightselectionLabel.setOpaque (true); 1100 highlightselectionLabel.setBorder (BorderFactory.createLineBorder (Color.black)); 1101 panelconstraints.gridx = 1; 1102 panellayout.setConstraints(highlightselectionLabel, panelconstraints); 1103 highlight.add (highlightselectionLabel); 1104 button = new JButton ("..."); 1105 button.addActionListener (actionlistener); 1106 button.setActionCommand (OptionsActionListener.HIGHLIGHTSELECTION); 1107 panelconstraints.gridx = 2; 1108 panellayout.setConstraints(button, panelconstraints); 1109 highlight.add (button); 1110 // highlight - rectified 1111 label = new JLabel ((String)cc.rb.getObject ("options_OptionsDialog_colorPanel_highlight_rect")); 1112 panelconstraints.gridx = 0; 1113 panelconstraints.gridy = 1; 1114 panellayout.setConstraints(label, panelconstraints); 1115 highlight.add (label); 1116 highlightrectLabel = new JLabel (); 1117 highlightrectLabel.setPreferredSize (new Dimension (50,24)); 1118 highlightrectLabel.setOpaque (true); 1119 highlightrectLabel.setBorder (BorderFactory.createLineBorder (Color.black)); 1120 panelconstraints.gridx = 1; 1121 panellayout.setConstraints(highlightrectLabel, panelconstraints); 1122 highlight.add (highlightrectLabel); 1123 button = new JButton ("..."); 1124 button.addActionListener (actionlistener); 1125 button.setActionCommand (OptionsActionListener.HIGHLIGHTRECT); 1126 panelconstraints.gridx = 2; 1127 panellayout.setConstraints(button, panelconstraints); 1128 highlight.add (button); 1129 constraints.gridy = 3; 1130 constraints.gridx = 0; 1131 constraints.gridwidth = 1; 1132 layout.setConstraints(highlight, constraints); 1133 colorPanel.add (highlight); 1134 // misc - grid 1135 JPanel misc = new JPanel (); 1136 misc.setLayout (panellayout); 1137 misc.setBorder (BorderFactory.createTitledBorder((String)cc.rb.getObject ("options_OptionsDialog_colorPanel_misc_header"))); 1138 label = new JLabel ((String)cc.rb.getObject ("options_OptionsDialog_colorPanel_misc_grid")); 1139 panelconstraints.gridx = 0; 1140 panelconstraints.gridy = 0; 1141 panellayout.setConstraints(label, panelconstraints); 1142 misc.add (label); 1143 miscgridLabel = new JLabel (); 1144 miscgridLabel.setPreferredSize (new Dimension (50,24)); 1145 miscgridLabel.setOpaque (true); 1146 miscgridLabel.setBorder (BorderFactory.createLineBorder (Color.black)); 1147 panelconstraints.gridx = 1; 1148 panellayout.setConstraints(miscgridLabel, panelconstraints); 1149 misc.add (miscgridLabel); 1150 button = new JButton ("..."); 1151 button.addActionListener (actionlistener); 1152 button.setActionCommand (OptionsActionListener.COLORGRID); 1153 panelconstraints.gridx = 2; 1154 panellayout.setConstraints(button, panelconstraints); 1155 misc.add (button); 1156 // misc - background 1157 label = new JLabel ((String)cc.rb.getObject ("options_OptionsDialog_colorPanel_misc_background")); 1158 panelconstraints.gridx = 0; 1159 panelconstraints.gridy = 1; 1160 panellayout.setConstraints(label, panelconstraints); 1161 misc.add (label); 1162 miscbackgroundLabel = new JLabel (); 1163 miscbackgroundLabel.setPreferredSize (new Dimension (50,24)); 1164 miscbackgroundLabel.setOpaque (true); 1165 miscbackgroundLabel.setBorder (BorderFactory.createLineBorder (Color.black)); 1166 panelconstraints.gridx = 1; 1167 panellayout.setConstraints(miscbackgroundLabel, panelconstraints); 1168 misc.add (miscbackgroundLabel); 1169 button = new JButton ("..."); 1170 button.addActionListener (actionlistener); 1171 button.setActionCommand (OptionsActionListener.COLORBACKGROUND); 1172 panelconstraints.gridx = 2; 1173 panellayout.setConstraints(button, panelconstraints); 1174 misc.add (button); 1175 // misc - lasso 1176 label = new JLabel ((String)cc.rb.getObject ("options_OptionsDialog_colorPanel_misc_lasso")); 1177 panelconstraints.gridx = 0; 1178 panelconstraints.gridy = 2; 1179 panellayout.setConstraints(label, panelconstraints); 1180 misc.add (label); 1181 misclassoLabel = new JLabel (); 1182 misclassoLabel.setPreferredSize (new Dimension (50,24)); 1183 misclassoLabel.setOpaque (true); 1184 misclassoLabel.setBorder (BorderFactory.createLineBorder (Color.black)); 1185 panelconstraints.gridx = 1; 1186 panellayout.setConstraints(misclassoLabel, panelconstraints); 1187 misc.add (misclassoLabel); 1188 button = new JButton ("..."); 1189 button.addActionListener (actionlistener); 1190 button.setActionCommand (OptionsActionListener.COLORLASSO); 1191 panelconstraints.gridx = 2; 1192 panellayout.setConstraints(button, panelconstraints); 1193 misc.add (button); 1194 constraints.gridy = 3; 1195 constraints.gridx = 1; 1196 constraints.gridwidth = 1; 1197 layout.setConstraints(misc, constraints); 1198 colorPanel.add (misc); 1199 // all done... 1200 tabs.addTab ((String)cc.rb.getObject ("options_OptionsDialog_colorPanel_tabheader"),null,colorPanel,(String)cc.rb.getObject ("options_OptionsDialog_colorPanel_tabheader_tooltip")); 1201 } 1202 1203 /** creates the GUI for the Accelerators tab */ initAcceleratorPanel()1204 private void initAcceleratorPanel () 1205 { 1206 acceleratorPanel = new JPanel (); 1207 acceleratorPanel.setBorder (new EmptyBorder (10,10,10,10)); 1208 acceleratorPanel.setLayout (new BorderLayout()); 1209 // one JTable, left column for functions 1210 // right column to display the current accelerator 1211 JPanel tablepanel = new JPanel (); 1212 tablepanel.setBorder (BorderFactory.createTitledBorder((String)cc.rb.getObject ("options_OptionsDialog_acceleratorPanel_tabletitle"))); 1213 tablemodel = new AcceleratorTableModel (); 1214 acceleratorTable = new JTable (tablemodel); 1215 acceleratorTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 1216 JScrollPane tablescroll = new JScrollPane (acceleratorTable); 1217 tablescroll.setPreferredSize (new Dimension (500,300)); 1218 ListSelectionModel rowSM = acceleratorTable.getSelectionModel(); 1219 lsListener = new AcceleratorTableListSelectionListener(dialog); 1220 rowSM.addListSelectionListener(lsListener); 1221 tablepanel.add(tablescroll); 1222 acceleratorPanel.add (tablepanel, BorderLayout.CENTER); 1223 // modification support 1224 JPanel selectaccPanel = new JPanel (); 1225 selectaccPanel.setLayout (new BoxLayout(selectaccPanel, BoxLayout.Y_AXIS)); 1226 selectaccPanel.setBorder(BorderFactory.createTitledBorder((String)cc.rb.getObject ("options_OptionsDialog_acceleratorPanel_southpaneltitle"))); 1227 // radiogroup for modifiers 1228 JPanel modpanel = new JPanel (); 1229 modpanel.setLayout (new FlowLayout ()); 1230 ButtonGroup modifiers = new ButtonGroup (); 1231 CTRLbutton = new JRadioButton ("CTRL "); 1232 modifiers.add(CTRLbutton); 1233 modpanel.add (CTRLbutton); 1234 SHIFTbutton = new JRadioButton("SHIFT "); 1235 modifiers.add (SHIFTbutton); 1236 modpanel.add (SHIFTbutton); 1237 ALTbutton = new JRadioButton ("ALT "); 1238 modifiers.add (ALTbutton); 1239 modpanel.add (ALTbutton); 1240 NONEbutton = new JRadioButton ("NONE "); 1241 modifiers.add (NONEbutton); 1242 modpanel.add (NONEbutton); 1243 // combobox for key constants... 1244 keySelectionComboBox = initKeySelectionCB (); 1245 modpanel.add (keySelectionComboBox); 1246 selectaccPanel.add (modpanel); 1247 // ...and the buttons to apply changes and to remove assignments 1248 JPanel accbuttons = new JPanel (); 1249 accbuttons.setLayout (new FlowLayout ()); 1250 applyAcceleratorButton = new JButton ((String)cc.rb.getObject ("general_Apply")); 1251 applyAcceleratorButton.setToolTipText ((String)cc.rb.getObject("options_OptionsDialog_acceleratorPanel_applybuttontooltip")); 1252 applyAcceleratorButton.addActionListener (actionlistener); 1253 applyAcceleratorButton.setActionCommand (OptionsActionListener.APPLY_ACCELERATOR); 1254 applyAcceleratorButton.setMnemonic (((Integer)cc.rb.getObject("options_OptionsDialog_acceleratorPanel_applybuttonmnemonic")).intValue()); 1255 // applyAcceleratorButton.setAlignmentX (CENTER_ALIGNMENT); 1256 accbuttons.add (applyAcceleratorButton); 1257 removeAcceleratorButton = new JButton ((String)cc.rb.getObject ("options_OptionsDialog_acceleratorPanel_removebutton")); 1258 removeAcceleratorButton.setToolTipText((String)cc.rb.getObject ("options_OptionsDialog_acceleratorPanel_removebuttontooltip")); 1259 removeAcceleratorButton.setMnemonic (((Integer)cc.rb.getObject("options_OptionsDialog_acceleratorPanel_removebuttonmnemonic")).intValue()); 1260 removeAcceleratorButton.addActionListener (actionlistener); 1261 removeAcceleratorButton.setActionCommand (OptionsActionListener.REMOVE_ACCELERATOR); 1262 // removeAcceleratorButton.setAlignmentX (CENTER_ALIGNMENT); 1263 accbuttons.add (removeAcceleratorButton); 1264 selectaccPanel.add (accbuttons); 1265 acceleratorPanel.add (selectaccPanel, BorderLayout.SOUTH); 1266 // ok all done 1267 tabs.addTab ((String)cc.rb.getObject ("options_OptionsDialog_acceleratorPanel_tabheader"),null,acceleratorPanel,(String)cc.rb.getObject ("options_OptionsDialog_acceleratorPanel_tabheader_tooltip")); 1268 } 1269 1270 /** 1271 * a little bit ugly here, all valid entries are stored in the 1272 * key selection combo box of the ACCELERATORS tab 1273 * directly to make sure only supported keys are shown 1274 */ initKeySelectionCB()1275 private JComboBox initKeySelectionCB () 1276 { 1277 JComboBox combo = new JComboBox(); 1278 combo.addItem ("NONE"); 1279 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_0)); 1280 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_1)); 1281 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_2)); 1282 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_3)); 1283 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_4)); 1284 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_5)); 1285 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_6)); 1286 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_7)); 1287 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_8)); 1288 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_9)); 1289 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_A)); 1290 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_B)); 1291 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_C)); 1292 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_D)); 1293 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_DELETE)); 1294 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_E)); 1295 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_END)); 1296 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_F)); 1297 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_F1)); 1298 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_F10)); 1299 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_F11)); 1300 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_F12)); 1301 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_F2)); 1302 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_F3)); 1303 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_F4)); 1304 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_F5)); 1305 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_F6)); 1306 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_F7)); 1307 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_F8)); 1308 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_F9)); 1309 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_G)); 1310 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_H)); 1311 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_HOME)); 1312 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_I)); 1313 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_INSERT)); 1314 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_J)); 1315 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_K)); 1316 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_L)); 1317 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_M)); 1318 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_N)); 1319 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_O)); 1320 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_P)); 1321 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_PAGE_DOWN)); 1322 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_PAGE_UP)); 1323 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_Q)); 1324 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_R)); 1325 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_S)); 1326 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_T)); 1327 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_U)); 1328 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_V)); 1329 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_W)); 1330 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_X)); 1331 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_Y)); 1332 combo.addItem (Accelerators.getKeyString(KeyEvent.VK_Z)); 1333 combo.setSelectedIndex (0); 1334 return combo; 1335 } 1336 1337 /** creates the GUI for the ADDON tab */ initAddonPanel()1338 private void initAddonPanel () 1339 { 1340 1341 } 1342 1343 /** creates the GUI for the OTHER tab */ initOtherPanel()1344 private void initOtherPanel () 1345 { 1346 // basics 1347 otherPanel = new JPanel (); 1348 otherPanel.setBorder (new EmptyBorder (10,10,10,10)); 1349 GridBagLayout layout = new GridBagLayout (); 1350 GridBagConstraints constraints = new GridBagConstraints (); 1351 otherPanel.setLayout (layout); 1352 JLabel label; 1353 // look&feel selection 1354 label = new JLabel ((String)cc.rb.getObject ("options_OptionsDialog_otherPanel_lookandfeel")+":"); 1355 label.setDisplayedMnemonic (((Character)cc.rb.getObject ("options_OptionsDialog_otherPanel_lookandfeel_mnemonic")).charValue()); 1356 label.setLabelFor (lookfeelCombo); 1357 constraints.gridy = 0; 1358 constraints.gridx = 0; 1359 layout.setConstraints (label, constraints); 1360 otherPanel.add (label); 1361 1362 lookfeelCombo = new JComboBox (); 1363 lookfeelCombo.addItem ("Java Look&Feel"); 1364 lookfeelCombo.addItem ("Motif Look&Feel"); 1365 lookfeelCombo.addItem ("Windows Look&Feel"); 1366 lookfeelCombo.addItem ("Mac Look&Feel"); 1367 constraints.gridx = 1; 1368 layout.setConstraints (lookfeelCombo, constraints); 1369 otherPanel.add (lookfeelCombo); 1370 1371 1372 label = new JLabel ((String)cc.rb.getObject ("options_OptionsDialog_otherPanel_screenx")+":"); 1373 label.setDisplayedMnemonic (((Character)cc.rb.getObject ("options_OptionsDialog_otherPanel_screenx_mnemonic")).charValue()); 1374 constraints.gridy = 1; 1375 constraints.gridx = 0; 1376 layout.setConstraints (label, constraints); 1377 otherPanel.add (label); 1378 1379 constraints.gridx = 1; 1380 screenx_TF=new JTextField(""+parent.getDrawingArea().screenx,6); 1381 layout.setConstraints (screenx_TF, constraints); 1382 otherPanel.add (screenx_TF); 1383 1384 1385 label = new JLabel ((String)cc.rb.getObject ("options_OptionsDialog_otherPanel_screeny")+":"); 1386 label.setDisplayedMnemonic (((Character)cc.rb.getObject ("options_OptionsDialog_otherPanel_screeny_mnemonic")).charValue()); 1387 constraints.gridy = 2; 1388 constraints.gridx = 0; 1389 layout.setConstraints (label, constraints); 1390 otherPanel.add (label); 1391 1392 constraints.gridx = 1; 1393 screeny_TF=new JTextField(""+parent.getDrawingArea().screeny,6); 1394 layout.setConstraints (screeny_TF, constraints); 1395 otherPanel.add (screeny_TF); 1396 1397 // adding the whole panel to the GUI 1398 tabs.addTab ((String)cc.rb.getObject ("options_OptionsDialog_otherPanel_tabheader"),null,otherPanel,(String)cc.rb.getObject ("options_OptionsDialog_otherPanel_tabheader_tooltip")); 1399 } 1400 1401 /** 1402 * sets the focus to the General tab 1403 */ setFocusToGeneral()1404 public void setFocusToGeneral () 1405 { 1406 tabs.setSelectedIndex (tabs.indexOfComponent (generalPanel)); 1407 } 1408 1409 /** 1410 * sets the focus to the Draw tab 1411 */ setFocusToDraw()1412 public void setFocusToDraw () 1413 { 1414 tabs.setSelectedIndex (tabs.indexOfComponent (drawPanel)); 1415 } 1416 1417 /** 1418 * sets the focus to the Color tab 1419 */ setFocusToColor()1420 public void setFocusToColor () 1421 { 1422 tabs.setSelectedIndex (tabs.indexOfComponent (colorPanel)); 1423 } 1424 /** 1425 * sets the focus to the Accelerator tab 1426 */ setFocusToAccelerator()1427 public void setFocusToAccelerator () 1428 { 1429 tabs.setSelectedIndex (tabs.indexOfComponent (acceleratorPanel)); 1430 } 1431 /** 1432 * sets the focus to the Misc tab 1433 */ setFocusToMisc()1434 public void setFocusToMisc () 1435 { 1436 tabs.setSelectedIndex (tabs.indexOfComponent (otherPanel)); 1437 } 1438 1439 1440 /** 1441 * this is one of the two important methods in this class. 1442 * it instantiates a new dialog object and sets up its gui 1443 * 1444 * @param parent - the parent frame for the dialog it is centered on 1445 */ initialize(MainFrame parent)1446 public static void initialize(MainFrame parent) 1447 { 1448 dialog = new OptionsDialog (parent); 1449 } 1450 1451 /** 1452 * if initialize() has been called before (i.e. the dialog has been 1453 * instanciated), this method just lets the dialog pop up modally on the 1454 * screen. 1455 */ showDialog()1456 public static void showDialog() 1457 { 1458 if (dialog != null) 1459 { 1460 dialog.updateGUI (); 1461 dialog.lsListener.setParent (dialog); 1462 dialog.setLocationRelativeTo (dialog.parent); 1463 dialog.setVisible(true); 1464 } 1465 else 1466 { 1467 System.err.println ("OptionsDialog requires you to call initialize before calling showDialog."); 1468 } 1469 } 1470 1471 /** 1472 * shows the dialog with initial focus to the general tab 1473 */ showGeneral()1474 public static void showGeneral() 1475 { 1476 dialog.setFocusToGeneral (); 1477 showDialog (); 1478 } 1479 1480 /** 1481 * shows the dialog with initial focus to the draw tab 1482 */ showDraw()1483 public static void showDraw() 1484 { 1485 dialog.setFocusToDraw (); 1486 showDialog (); 1487 } 1488 1489 /** 1490 * shows the dialog with initial focus to the Color tab 1491 */ showColor()1492 public static void showColor() 1493 { 1494 dialog.setFocusToColor (); 1495 showDialog (); 1496 } 1497 1498 /** 1499 * shows the dialog with initial focus to the accelerator tab 1500 */ showAccelerator()1501 public static void showAccelerator() 1502 { 1503 dialog.setFocusToAccelerator (); 1504 showDialog (); 1505 } 1506 1507 /** 1508 * shows the dialog with initial focus to the misc tab 1509 */ showMisc()1510 public static void showMisc() 1511 { 1512 dialog.setFocusToMisc (); 1513 showDialog (); 1514 } 1515 1516 1517 /** 1518 * reads all values in the Options class and sets the GUI elements 1519 * accordingly 1520 */ updateGUI()1521 public void updateGUI () 1522 { 1523 // general tab 1524 devhomeTextField.setText (cc.op.get (Options.general_devisorhome)); 1525 generalpathTextField.setText (cc.op.get (Options.general_path)); 1526 trigenTextField.setText (cc.op.get (Options.general_trigen)); 1527 featlibTextField.setText (cc.op.get (Options.general_featlib)); 1528 // draw tab 1529 drawboundaryCheck.setSelected (Boolean.valueOf(cc.op.get (Options.draw_drawboundary)).booleanValue()); 1530 numberboundaryCheck.setSelected (Boolean.valueOf(cc.op.get (Options.draw_numberboundary)).booleanValue()); 1531 drawnodeCheck.setSelected (Boolean.valueOf(cc.op.get (Options.draw_drawnode)).booleanValue()); 1532 numbernodeCheck.setSelected (Boolean.valueOf(cc.op.get (Options.draw_numbernode)).booleanValue()); 1533 drawedgeCheck.setSelected (Boolean.valueOf(cc.op.get (Options.draw_drawedge)).booleanValue()); 1534 numberedgeCheck.setSelected (Boolean.valueOf(cc.op.get (Options.draw_numberedge)).booleanValue()); 1535 drawelementCheck.setSelected (Boolean.valueOf(cc.op.get (Options.draw_drawelement)).booleanValue()); 1536 numberelementCheck.setSelected (Boolean.valueOf(cc.op.get (Options.draw_numberelement)).booleanValue()); 1537 crosselementCheck.setSelected (Boolean.valueOf(cc.op.get (Options.draw_crosselement)).booleanValue()); 1538 fillelementCheck.setSelected (Boolean.valueOf(cc.op.get (Options.draw_fillelement)).booleanValue()); 1539 drawgridCheck.setSelected (Boolean.valueOf(cc.op.get (Options.draw_drawgrid)).booleanValue()); 1540 drawperimeterCheck.setSelected (Boolean.valueOf(cc.op.get (Options.draw_drawperimeter)).booleanValue()); 1541 drawrectCheck.setSelected (Boolean.valueOf(cc.op.get (Options.draw_drawrect)).booleanValue()); 1542 snapCheck.setSelected (Boolean.valueOf (cc.op.get (Options.snap_enabled)).booleanValue ()); 1543 if (snapCheck.isSelected ()) 1544 { 1545 snapXTF.setText (cc.op.get(Options.snap_x)); 1546 snapYTF.setText (cc.op.get(Options.snap_y)); 1547 } 1548 toleranceTF.setText (cc.op.get (Options.click_tolerance)); 1549 drawcoordsCheck.setSelected (Boolean.valueOf (cc.op.get (Options.draw_usercoords)).booleanValue ()); 1550 draworimarkerCheck.setSelected (Boolean.valueOf (cc.op.get(Options.draw_orientationmarkers)).booleanValue ()); 1551 epsilonSlider.setValue (Integer.parseInt (cc.op.get (Options.epsilon))); 1552 1553 // color tab 1554 colornodeLabel.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_node)))); 1555 coloredgeLabel.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_edge)))); 1556 coloredgebaseLabel.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_edgebase)))); 1557 colorelementLabel.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_element)))); 1558 numberboundaryLabel.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_boundarynumber)))); 1559 numbernodeLabel.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_nodenumber)))); 1560 numberedgeLabel.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_edgenumber)))); 1561 numberelementLabel.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_elementnumber)))); 1562 fill0Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_fill0)))); 1563 fill1Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_fill1)))); 1564 fill2Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_fill2)))); 1565 fill3Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_fill3)))); 1566 fill4Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_fill4)))); 1567 fill5Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_fill5)))); 1568 fill6Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_fill6)))); 1569 fill7Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_fill7)))); 1570 fill8Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_fill8)))); 1571 fill9Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_fill9)))); 1572 fill10Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_fill10)))); 1573 fill11Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_fill11)))); 1574 fill12Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_fill12)))); 1575 fill13Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_fill13)))); 1576 fill14Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_fill14)))); 1577 fill15Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_fill15)))); 1578 bound0Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_boundary0)))); 1579 bound1Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_boundary1)))); 1580 bound2Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_boundary2)))); 1581 bound3Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_boundary3)))); 1582 bound4Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_boundary4)))); 1583 bound5Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_boundary5)))); 1584 bound6Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_boundary6)))); 1585 bound7Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_boundary7)))); 1586 bound8Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_boundary8)))); 1587 bound9Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_boundary9)))); 1588 bound10Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_boundary10)))); 1589 bound11Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_boundary11)))); 1590 bound12Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_boundary12)))); 1591 bound13Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_boundary13)))); 1592 bound14Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_boundary14)))); 1593 bound15Label.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_boundary15)))); 1594 highlightselectionLabel.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_selection)))); 1595 highlightrectLabel.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_rect)))); 1596 miscgridLabel.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_grid)))); 1597 miscbackgroundLabel.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_background)))); 1598 misclassoLabel.setBackground (new Color (Integer.parseInt(cc.op.get(Options.color_lasso)))); 1599 1600 1601 // accelerators tab 1602 tablemodel = new AcceleratorTableModel (); 1603 acceleratorTable.setModel (tablemodel); 1604 1605 // other tab 1606 // look and feel 1607 if (cc.op.get(Options.other_lookandfeel).equals(UIManager.getCrossPlatformLookAndFeelClassName ())) 1608 { 1609 lookfeelCombo.setSelectedItem("Java Look&Feel"); 1610 } 1611 if (cc.op.get(Options.other_lookandfeel).equals("com.sun.java.swing.plaf.windows.WindowsLookAndFeel")) 1612 { 1613 lookfeelCombo.setSelectedItem("Windows Look&Feel"); 1614 } 1615 if (cc.op.get(Options.other_lookandfeel).equals("com.sun.java.swing.plaf.motif.MotifLookAndFeel")) 1616 { 1617 lookfeelCombo.setSelectedItem("Motif Look&Feel"); 1618 } 1619 if (cc.op.get(Options.other_lookandfeel).equals("javax.swing.plaf.mac.MacLookAndFeel")) 1620 { 1621 lookfeelCombo.setSelectedItem("Mac Look&Feel"); 1622 } 1623 } 1624 1625 /** 1626 * reads all values from the GUI elements and sets the Options 1627 * class accordingly 1628 */ updateOptions()1629 public void updateOptions () 1630 { 1631 // general panel 1632 1633 cc.op.set (Options.general_devisorhome, devhomeTextField.getText()); 1634 cc.op.set (Options.general_path, generalpathTextField.getText()); 1635 cc.op.set (Options.general_trigen, trigenTextField.getText()); 1636 cc.op.set (Options.general_featlib, featlibTextField.getText()); 1637 cc.op.set (Options.general_helpfile, "file://"+cc.op.get(Options.general_devisorhome)+System.getProperty("file.separator")+"manual"+System.getProperty("file.separator")+"html"+System.getProperty("file.separator")+"DeViSoRGrid2_Manual.html"); 1638 cc.op.set (Options.general_faqfile, "file://"+cc.op.get(Options.general_devisorhome)+System.getProperty("file.separator")+"manual"+System.getProperty("file.separator")+"html"+System.getProperty("file.separator")+"FAQ.html"); 1639 // draw options 1640 if (drawboundaryCheck.isSelected()) 1641 cc.op.set (Options.draw_drawboundary, "true"); 1642 else 1643 cc.op.set (Options.draw_drawboundary, "false"); 1644 if (numberboundaryCheck.isSelected()) 1645 cc.op.set (Options.draw_numberboundary, "true"); 1646 else 1647 cc.op.set (Options.draw_numberboundary, "false"); 1648 if (drawnodeCheck.isSelected()) 1649 cc.op.set (Options.draw_drawnode, "true"); 1650 else 1651 cc.op.set (Options.draw_drawnode, "false"); 1652 if (numbernodeCheck.isSelected()) 1653 cc.op.set (Options.draw_numbernode, "true"); 1654 else 1655 cc.op.set (Options.draw_numbernode, "false"); 1656 if (drawedgeCheck.isSelected()) 1657 cc.op.set (Options.draw_drawedge, "true"); 1658 else 1659 cc.op.set (Options.draw_drawedge, "false"); 1660 if (numberedgeCheck.isSelected()) 1661 cc.op.set (Options.draw_numberedge, "true"); 1662 else 1663 cc.op.set (Options.draw_numberedge, "false"); 1664 if (drawelementCheck.isSelected()) 1665 cc.op.set (Options.draw_drawelement, "true"); 1666 else 1667 cc.op.set (Options.draw_drawelement, "false"); 1668 if (numberelementCheck.isSelected()) 1669 cc.op.set (Options.draw_numberelement, "true"); 1670 else 1671 cc.op.set (Options.draw_numberelement, "false"); 1672 if (crosselementCheck.isSelected()) 1673 cc.op.set (Options.draw_crosselement, "true"); 1674 else 1675 cc.op.set (Options.draw_crosselement, "false"); 1676 if (fillelementCheck.isSelected()) 1677 cc.op.set (Options.draw_fillelement, "true"); 1678 else 1679 cc.op.set (Options.draw_fillelement, "false"); 1680 if (drawgridCheck.isSelected()) 1681 cc.op.set (Options.draw_drawgrid, "true"); 1682 else 1683 cc.op.set (Options.draw_drawgrid, "false"); 1684 if (drawperimeterCheck.isSelected()) 1685 cc.op.set (Options.draw_drawperimeter, "true"); 1686 else 1687 cc.op.set (Options.draw_drawperimeter, "false"); 1688 if (drawrectCheck.isSelected()) 1689 cc.op.set (Options.draw_drawrect, "true"); 1690 else 1691 cc.op.set (Options.draw_drawrect, "false"); 1692 if (snapCheck.isSelected()) 1693 { 1694 cc.op.set (Options.snap_enabled, "true"); 1695 cc.op.set (Options.snap_x, snapXTF.getText()); 1696 cc.op.set (Options.snap_y, snapYTF.getText()); 1697 } 1698 else 1699 { 1700 cc.op.set (Options.snap_enabled, "false"); 1701 } 1702 cc.op.set (Options.click_tolerance, toleranceTF.getText()); 1703 1704 cc.op.set(Options.screenx, screenx_TF.getText()); 1705 cc.op.set(Options.screeny, screeny_TF.getText()); 1706 1707 if (drawcoordsCheck.isSelected()) 1708 cc.op.set (Options.draw_usercoords, "true"); 1709 else 1710 cc.op.set (Options.draw_usercoords, "false"); 1711 if (draworimarkerCheck.isSelected()) 1712 cc.op.set (Options.draw_orientationmarkers, "true"); 1713 else 1714 cc.op.set (Options.draw_orientationmarkers, "false"); 1715 1716 cc.op.set (Options.epsilon, Integer.toString(epsilonSlider.getValue ())); 1717 // color panel 1718 cc.op.set (Options.color_node, Integer.toString(colornodeLabel.getBackground().getRGB())); 1719 cc.op.set (Options.color_edge, Integer.toString(coloredgeLabel.getBackground().getRGB())); 1720 cc.op.set (Options.color_edgebase, Integer.toString(coloredgebaseLabel.getBackground().getRGB())); 1721 cc.op.set (Options.color_element, Integer.toString(colorelementLabel.getBackground().getRGB())); 1722 cc.op.set (Options.color_boundarynumber, Integer.toString(numberboundaryLabel.getBackground().getRGB())); 1723 cc.op.set (Options.color_nodenumber, Integer.toString(numbernodeLabel.getBackground().getRGB())); 1724 cc.op.set (Options.color_edgenumber, Integer.toString(numberedgeLabel.getBackground().getRGB())); 1725 cc.op.set (Options.color_elementnumber, Integer.toString(numberelementLabel.getBackground().getRGB())); 1726 cc.op.set (Options.color_fill0, Integer.toString(fill0Label.getBackground().getRGB())); 1727 cc.op.set (Options.color_fill0, Integer.toString(fill0Label.getBackground().getRGB())); 1728 cc.op.set (Options.color_fill1, Integer.toString(fill1Label.getBackground().getRGB())); 1729 cc.op.set (Options.color_fill2, Integer.toString(fill2Label.getBackground().getRGB())); 1730 cc.op.set (Options.color_fill3, Integer.toString(fill3Label.getBackground().getRGB())); 1731 cc.op.set (Options.color_fill4, Integer.toString(fill4Label.getBackground().getRGB())); 1732 cc.op.set (Options.color_fill5, Integer.toString(fill5Label.getBackground().getRGB())); 1733 cc.op.set (Options.color_fill6, Integer.toString(fill6Label.getBackground().getRGB())); 1734 cc.op.set (Options.color_fill7, Integer.toString(fill7Label.getBackground().getRGB())); 1735 cc.op.set (Options.color_fill8, Integer.toString(fill8Label.getBackground().getRGB())); 1736 cc.op.set (Options.color_fill9, Integer.toString(fill9Label.getBackground().getRGB())); 1737 cc.op.set (Options.color_fill10, Integer.toString(fill10Label.getBackground().getRGB())); 1738 cc.op.set (Options.color_fill11, Integer.toString(fill11Label.getBackground().getRGB())); 1739 cc.op.set (Options.color_fill12, Integer.toString(fill12Label.getBackground().getRGB())); 1740 cc.op.set (Options.color_fill13, Integer.toString(fill13Label.getBackground().getRGB())); 1741 cc.op.set (Options.color_fill14, Integer.toString(fill14Label.getBackground().getRGB())); 1742 cc.op.set (Options.color_fill15, Integer.toString(fill15Label.getBackground().getRGB())); 1743 cc.op.set (Options.color_selection, Integer.toString(highlightselectionLabel.getBackground().getRGB())); 1744 cc.op.set (Options.color_rect, Integer.toString(highlightrectLabel.getBackground().getRGB())); 1745 cc.op.set (Options.color_grid, Integer.toString(miscgridLabel.getBackground().getRGB())); 1746 cc.op.set (Options.color_background, Integer.toString(miscbackgroundLabel.getBackground().getRGB())); 1747 cc.op.set (Options.color_lasso, Integer.toString(misclassoLabel.getBackground().getRGB())); 1748 cc.op.set (Options.color_boundary0, Integer.toString(bound0Label.getBackground().getRGB())); 1749 cc.op.set (Options.color_boundary1, Integer.toString(bound1Label.getBackground().getRGB())); 1750 cc.op.set (Options.color_boundary2, Integer.toString(bound2Label.getBackground().getRGB())); 1751 cc.op.set (Options.color_boundary3, Integer.toString(bound3Label.getBackground().getRGB())); 1752 cc.op.set (Options.color_boundary4, Integer.toString(bound4Label.getBackground().getRGB())); 1753 cc.op.set (Options.color_boundary5, Integer.toString(bound5Label.getBackground().getRGB())); 1754 cc.op.set (Options.color_boundary6, Integer.toString(bound6Label.getBackground().getRGB())); 1755 cc.op.set (Options.color_boundary7, Integer.toString(bound7Label.getBackground().getRGB())); 1756 cc.op.set (Options.color_boundary8, Integer.toString(bound8Label.getBackground().getRGB())); 1757 cc.op.set (Options.color_boundary9, Integer.toString(bound9Label.getBackground().getRGB())); 1758 cc.op.set (Options.color_boundary10, Integer.toString(bound10Label.getBackground().getRGB())); 1759 cc.op.set (Options.color_boundary11, Integer.toString(bound11Label.getBackground().getRGB())); 1760 cc.op.set (Options.color_boundary12, Integer.toString(bound12Label.getBackground().getRGB())); 1761 cc.op.set (Options.color_boundary13, Integer.toString(bound13Label.getBackground().getRGB())); 1762 cc.op.set (Options.color_boundary14, Integer.toString(bound14Label.getBackground().getRGB())); 1763 cc.op.set (Options.color_boundary15, Integer.toString(bound15Label.getBackground().getRGB())); 1764 1765 1766 // accelerators panel 1767 1768 // no need to do anything here, the table writes itself back to the 1769 // options instance 1770 1771 //other panel 1772 String lookandfeel = (String)lookfeelCombo.getSelectedItem (); 1773 if (lookandfeel.equals("Java Look&Feel")) 1774 { 1775 cc.op.set(Options.other_lookandfeel,UIManager.getCrossPlatformLookAndFeelClassName()); 1776 } 1777 if (lookandfeel.equals("Windows Look&Feel")) 1778 { 1779 cc.op.set (Options.other_lookandfeel, "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); 1780 } 1781 if (lookandfeel.equals("Motif Look&Feel")) 1782 { 1783 cc.op.set (Options.other_lookandfeel, "com.sun.java.swing.plaf.motif.MotifLookAndFeel"); 1784 } 1785 if (lookandfeel.equals("Mac Look&Feel")) 1786 { 1787 cc.op.set (Options.other_lookandfeel, "javax.swing.plaf.mac.MacLookAndFeel"); 1788 } 1789 1790 1791 1792 1793 } 1794 1795 1796 1797 /** components of the dialog */ 1798 private JTabbedPane tabs; 1799 // general panel 1800 private JPanel generalPanel; 1801 private JTextField devhomeTextField; 1802 private JButton devhomeButton; 1803 private JTextField generalpathTextField; 1804 private JButton generalpathButton; 1805 private JTextField trigenTextField; 1806 private JButton trigenButton; 1807 private JTextField featlibTextField; 1808 private JButton featlibButton; 1809 1810 // draw panel 1811 private JPanel drawPanel; 1812 private JCheckBox drawboundaryCheck; 1813 private JCheckBox numberboundaryCheck; 1814 private JCheckBox drawnodeCheck; 1815 private JCheckBox numbernodeCheck; 1816 private JCheckBox drawedgeCheck; 1817 private JCheckBox numberedgeCheck; 1818 private JCheckBox drawelementCheck; 1819 private JCheckBox numberelementCheck; 1820 private JCheckBox crosselementCheck; 1821 private JCheckBox fillelementCheck; 1822 private JCheckBox drawgridCheck; 1823 private JCheckBox drawperimeterCheck; 1824 private JCheckBox drawrectCheck; 1825 private JCheckBox snapCheck; 1826 private JTextField snapXTF, snapYTF; 1827 private JTextField toleranceTF; 1828 private JCheckBox drawcoordsCheck; 1829 private JCheckBox draworimarkerCheck; 1830 private JSlider epsilonSlider; 1831 1832 // color panel 1833 private JPanel colorPanel; 1834 private JLabel colornodeLabel; 1835 private JLabel colorelementLabel; 1836 private JLabel coloredgeLabel; 1837 private JLabel coloredgebaseLabel; 1838 private JLabel numberboundaryLabel; 1839 private JLabel numbernodeLabel; 1840 private JLabel numberelementLabel; 1841 private JLabel numberedgeLabel; 1842 private JLabel highlightselectionLabel; 1843 private JLabel highlightrectLabel; 1844 private JLabel miscgridLabel; 1845 private JLabel miscbackgroundLabel; 1846 private JLabel misclassoLabel; 1847 private JLabel fill0Label; 1848 private JLabel fill1Label; 1849 private JLabel fill2Label; 1850 private JLabel fill3Label; 1851 private JLabel fill4Label; 1852 private JLabel fill5Label; 1853 private JLabel fill6Label; 1854 private JLabel fill7Label; 1855 private JLabel fill8Label; 1856 private JLabel fill9Label; 1857 private JLabel fill10Label; 1858 private JLabel fill11Label; 1859 private JLabel fill12Label; 1860 private JLabel fill13Label; 1861 private JLabel fill14Label; 1862 private JLabel fill15Label; 1863 private JLabel bound0Label; 1864 private JLabel bound1Label; 1865 private JLabel bound2Label; 1866 private JLabel bound3Label; 1867 private JLabel bound4Label; 1868 private JLabel bound5Label; 1869 private JLabel bound6Label; 1870 private JLabel bound7Label; 1871 private JLabel bound8Label; 1872 private JLabel bound9Label; 1873 private JLabel bound10Label; 1874 private JLabel bound11Label; 1875 private JLabel bound12Label; 1876 private JLabel bound13Label; 1877 private JLabel bound14Label; 1878 private JLabel bound15Label; 1879 1880 // accelerators panel 1881 private JPanel acceleratorPanel; 1882 private JTable acceleratorTable; 1883 private AcceleratorTableModel tablemodel; 1884 private AcceleratorTableListSelectionListener lsListener; 1885 private JComboBox keySelectionComboBox; 1886 private JRadioButton CTRLbutton; 1887 private JRadioButton SHIFTbutton; 1888 private JRadioButton ALTbutton; 1889 private JRadioButton NONEbutton; 1890 private JButton applyAcceleratorButton; 1891 private JButton removeAcceleratorButton; 1892 // addon panel 1893 private JPanel addonPanel; 1894 // other panel 1895 private JPanel otherPanel; 1896 private JComboBox lookfeelCombo; 1897 private JTextField screenx_TF; 1898 private JTextField screeny_TF; 1899 1900 /** 1901 * quick getters and setters for the ones used from outside 1902 */ 1903 getDevHomeTextField()1904 public JTextField getDevHomeTextField () 1905 { 1906 return devhomeTextField; 1907 } getPathTextField()1908 public JTextField getPathTextField () 1909 { 1910 return generalpathTextField; 1911 } getTrigenTextField()1912 public JTextField getTrigenTextField () 1913 { 1914 return trigenTextField; 1915 } getFeatlibTextField()1916 public JTextField getFeatlibTextField () 1917 { 1918 return featlibTextField; 1919 } getKeySelectionComboBox()1920 public JComboBox getKeySelectionComboBox () 1921 { 1922 return this.keySelectionComboBox; 1923 } 1924 getCTRLbutton()1925 public JRadioButton getCTRLbutton() 1926 { 1927 return CTRLbutton; 1928 } 1929 getALTbutton()1930 public JRadioButton getALTbutton() 1931 { 1932 return ALTbutton; 1933 } getSHIFTbutton()1934 public JRadioButton getSHIFTbutton() 1935 { 1936 return SHIFTbutton; 1937 } getNONEbutton()1938 public JRadioButton getNONEbutton() 1939 { 1940 return NONEbutton; 1941 } getSnapCheck()1942 public JCheckBox getSnapCheck () 1943 { 1944 return snapCheck; 1945 } getSnapXTF()1946 public JTextField getSnapXTF () 1947 { 1948 return snapXTF; 1949 } getSnapYTF()1950 public JTextField getSnapYTF () 1951 { 1952 return snapYTF; 1953 } getEpsilonSlider()1954 public JSlider getEpsilonSlider () 1955 { 1956 return epsilonSlider; 1957 } getAcceleratorTableData()1958 public Vector getAcceleratorTableData () 1959 { 1960 return tablemodel.getData(); 1961 } getAcceleratorTable()1962 public JTable getAcceleratorTable () 1963 { 1964 return acceleratorTable; 1965 } getColornodeLabel()1966 public JLabel getColornodeLabel () 1967 { 1968 return colornodeLabel; 1969 } getColoredgeLabel()1970 public JLabel getColoredgeLabel () 1971 { 1972 return coloredgeLabel; 1973 } getColoredgebaseLabel()1974 public JLabel getColoredgebaseLabel () 1975 { 1976 return coloredgebaseLabel; 1977 } 1978 getColorelementLabel()1979 public JLabel getColorelementLabel () 1980 { 1981 return colorelementLabel; 1982 } getNumberboundaryLabel()1983 public JLabel getNumberboundaryLabel () 1984 { 1985 return numberboundaryLabel; 1986 } getNumbernodeLabel()1987 public JLabel getNumbernodeLabel () 1988 { 1989 return numbernodeLabel; 1990 } getNumberedgeLabel()1991 public JLabel getNumberedgeLabel () 1992 { 1993 return numberedgeLabel; 1994 } getNumberelementLabel()1995 public JLabel getNumberelementLabel () 1996 { 1997 return numberelementLabel; 1998 } getHighlightselectionLabel()1999 public JLabel getHighlightselectionLabel () 2000 { 2001 return highlightselectionLabel; 2002 } getHighlightrectLabel()2003 public JLabel getHighlightrectLabel () 2004 { 2005 return highlightrectLabel; 2006 } getMiscgridLabel()2007 public JLabel getMiscgridLabel () 2008 { 2009 return miscgridLabel; 2010 } getMiscbackgroundLabel()2011 public JLabel getMiscbackgroundLabel () 2012 { 2013 return miscbackgroundLabel; 2014 } getMisclassoLabel()2015 public JLabel getMisclassoLabel () 2016 { 2017 return misclassoLabel; 2018 } getFill0Label()2019 public JLabel getFill0Label () 2020 { 2021 return fill0Label; 2022 } getFill1Label()2023 public JLabel getFill1Label () 2024 { 2025 return fill1Label; 2026 } getFill2Label()2027 public JLabel getFill2Label () 2028 { 2029 return fill2Label; 2030 } getFill3Label()2031 public JLabel getFill3Label () 2032 { 2033 return fill3Label; 2034 } getFill4Label()2035 public JLabel getFill4Label () 2036 { 2037 return fill4Label; 2038 } getFill5Label()2039 public JLabel getFill5Label () 2040 { 2041 return fill5Label; 2042 } getFill6Label()2043 public JLabel getFill6Label () 2044 { 2045 return fill6Label; 2046 } getFill7Label()2047 public JLabel getFill7Label () 2048 { 2049 return fill7Label; 2050 } getFill8Label()2051 public JLabel getFill8Label () 2052 { 2053 return fill8Label; 2054 } getFill9Label()2055 public JLabel getFill9Label () 2056 { 2057 return fill9Label; 2058 } getFill10Label()2059 public JLabel getFill10Label () 2060 { 2061 return fill10Label; 2062 } getFill11Label()2063 public JLabel getFill11Label () 2064 { 2065 return fill11Label; 2066 } getFill12Label()2067 public JLabel getFill12Label () 2068 { 2069 return fill12Label; 2070 } getFill13Label()2071 public JLabel getFill13Label () 2072 { 2073 return fill13Label; 2074 } getFill14Label()2075 public JLabel getFill14Label () 2076 { 2077 return fill14Label; 2078 } getFill15Label()2079 public JLabel getFill15Label () 2080 { 2081 return fill15Label; 2082 } getBound0Label()2083 public JLabel getBound0Label () 2084 { 2085 return bound0Label; 2086 } getBound1Label()2087 public JLabel getBound1Label () 2088 { 2089 return bound1Label; 2090 } getBound2Label()2091 public JLabel getBound2Label () 2092 { 2093 return bound2Label; 2094 } getBound3Label()2095 public JLabel getBound3Label () 2096 { 2097 return bound3Label; 2098 } getBound4Label()2099 public JLabel getBound4Label () 2100 { 2101 return bound4Label; 2102 } getBound5Label()2103 public JLabel getBound5Label () 2104 { 2105 return bound5Label; 2106 } getBound6Label()2107 public JLabel getBound6Label () 2108 { 2109 return bound6Label; 2110 } getBound7Label()2111 public JLabel getBound7Label () 2112 { 2113 return bound7Label; 2114 } getBound8Label()2115 public JLabel getBound8Label () 2116 { 2117 return bound8Label; 2118 } getBound9Label()2119 public JLabel getBound9Label () 2120 { 2121 return bound9Label; 2122 } getBound10Label()2123 public JLabel getBound10Label () 2124 { 2125 return bound10Label; 2126 } getBound11Label()2127 public JLabel getBound11Label () 2128 { 2129 return bound11Label; 2130 } getBound12Label()2131 public JLabel getBound12Label () 2132 { 2133 return bound12Label; 2134 } getBound13Label()2135 public JLabel getBound13Label () 2136 { 2137 return bound13Label; 2138 } getBound14Label()2139 public JLabel getBound14Label () 2140 { 2141 return bound14Label; 2142 } getBound15Label()2143 public JLabel getBound15Label () 2144 { 2145 return bound15Label; 2146 } 2147 2148 2149 2150 2151 2152 } 2153 2154 2155