Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: ide/VeriSimPrefs.java


1   
2   /* **********************************
3    File: VeriSimPrefs.java
4    Author: Lucian Ghita Felix(felix@ulise.cs.pub.ro)
5    Created on 27-II-1999 4:05 pm*
6    Comments: Part of the vIDE Project
7               Copyright 1999 the vIDE Team.
8   ***********************************/
9   
10  package ide;
11  
12  import java.awt.*;
13  import java.awt.event.*;
14  import java.beans.*;
15  import javax.swing.*;
16  import javax.swing.border.*;
17  import javax.swing.plaf.metal.*;
18  
19  
20  /**
21    * This is dialog which allows users to choose preferences
22    * and made me have a terrible pain in the ass for a long time
23    * @version 1.0
24    * @author fEliX
25    */
26  public class VeriSimPrefs extends JDialog {
27  
28    VeriSimFrame god;
29    
30    private JDialog thisPanel;   //for use inside the inner actions.
31    
32    
33    
34    
35    ButtonGroup indentGroup;
36    JTextField tabField;
37    JTextField mrfField;
38    JTextField mrpField;
39    JCheckBox autosaveCheck;
40    JTextField autosaveField;
41    JCheckBox backupCheck;
42    JCheckBox loadLastProjectCheck;
43    JTextField undoField;
44    ButtonGroup saveGroup;  
45    ButtonGroup plafGroup;
46    ButtonGroup themeGroup;
47    
48    JList includeList;
49    JList modulesList;
50    
51    
52    JCheckBox saveBeforeRun;
53    
54    
55    
56    public VeriSimPrefs(JFrame f) {
57      super(f, "Preferences", true);
58      god = (VeriSimFrame) f;
59      thisPanel = this;
60      
61      JPanel container = new JPanel();
62      container.setLayout( new BorderLayout() );
63  
64      JTabbedPane tabs = new JTabbedPane();
65      
66      tabs.addTab( "General", null, buildTextPanel());
67      tabs.addTab( "CR/LF?", null, buildCrlfPanel());
68      tabs.addTab( "Look", null, buildPlafPanel() );
69      tabs.addTab( "Interpretor", null, buildVerilogPanel() );
70      tabs.addTab( "Directories", null, buildDirectoriesPanel() );
71  
72  
73      JPanel buttonPanel = new JPanel();
74      buttonPanel.setLayout ( new FlowLayout(FlowLayout.RIGHT) );
75      JButton cancel = new JButton("Cancel");
76      cancel.addActionListener(new ActionListener() {
77        public void actionPerformed(ActionEvent e) {
78          CancelPressed();
79      }});
80      buttonPanel.add( cancel );
81      
82      JButton ok = new JButton("OK");
83      ok.addActionListener(new ActionListener() {
84        public void actionPerformed(ActionEvent e) {
85          OKPressed();
86      }});
87      buttonPanel.add( ok );
88      getRootPane().setDefaultButton(ok);
89  
90      container.add(tabs, BorderLayout.CENTER);
91      container.add(buttonPanel, BorderLayout.SOUTH);
92      getContentPane().add(container);
93      pack();
94      centerDialog();
95      setResizable(false); 
96      
97      god.fHash.print();
98      //UIManager.addPropertyChangeListener(new UISwitchListener(container));
99    }
100 
101   public JPanel buildTextPanel() {
102     JPanel textPanel = new JPanel();
103     //GridLayout gridLayout = new GridLayout(0, 1);
104     //gridLayout.setVgap(3);
105     textPanel.setLayout(new ColumnLayout());
106     
107 
108     //  INDENTATION
109     JPanel indentPanel = new JPanel();
110 
111     JPanel upperPanel = new JPanel();
112     
113     
114     indentPanel.setLayout(new ColumnLayout());
115     indentPanel.setBorder( new TitledBorder("Indent") );
116     
117     indentGroup = new ButtonGroup();
118     JRadioButton noneIndent = new JRadioButton("none");
119     JRadioButton defaultIndent = new JRadioButton("default");
120     JRadioButton smartIndent = new JRadioButton("smart");
121     //todo
122     defaultIndent.setEnabled(false);
123     smartIndent.setEnabled(false);
124     
125     noneIndent.getModel().setActionCommand("none");
126     defaultIndent.getModel().setActionCommand("default");
127     smartIndent.getModel().setActionCommand("smart");
128     
129     
130     indentGroup.add(noneIndent);
131     indentGroup.add(defaultIndent);
132     indentGroup.add(smartIndent);
133     
134     indentPanel.add(noneIndent);
135     indentPanel.add(defaultIndent);
136     indentPanel.add(smartIndent);
137     
138     noneIndent.setSelected(((String)god.fHash.get("indentType")).equals("none"));
139     defaultIndent.setSelected(((String)god.fHash.get("indentType")).equals("default"));
140     smartIndent.setSelected(((String)god.fHash.get("indentType")).equals("smart"));
141     
142     upperPanel.add(indentPanel);
143     
144     JPanel rightPanel = new JPanel(new ColumnLayout());
145     
146     int val = 0;
147     
148     //  TAB SIZE
149     JLabel tabLabel = new JLabel("tab size:");
150     val = ((Integer)god.fHash.get("tabSize")).intValue();
151     
152     tabField = new JTextField(Integer.toString(val), 4);
153     JPanel tabPanel = new JPanel(new FlowLayout());
154     tabPanel.add(tabLabel);
155     tabPanel.add(tabField);
156     rightPanel.add(tabPanel);
157     
158     //  BACKUP
159     backupCheck = new JCheckBox("Backup on save",((Boolean)god.fHash.get("autobackup")).booleanValue());
160     //boolean bool = ((Boolean)god.fHash.get("autobackup")).booleanValue();
161     //((JToggleButton.ToggleButtonModel)(backupCheck.getModel())).setSelected(((Boolean)god.fHash.get("autobackup")).booleanValue());
162     rightPanel.add(backupCheck);
163     
164     loadLastProjectCheck = new JCheckBox("Load last project on startup",((Boolean)god.fHash.get("loadLastProject")).booleanValue());
165     rightPanel.add(loadLastProjectCheck);
166     
167     
168     //  MAX UNDO LEVEL
169     JLabel undoLabel = new JLabel("Undo buffer size:");
170     val = ((Integer)god.fHash.get("undoSize")).intValue();
171     undoField = new JTextField(Integer.toString(val), 3);
172     JPanel undoPanel = new JPanel(new FlowLayout());
173     undoPanel.add(undoLabel);
174     undoPanel.add(undoField);
175     
176     rightPanel.add(undoPanel);
177     
178     
179     upperPanel.add(rightPanel);
180     textPanel.add(upperPanel);
181     
182     
183     //  MOST RECENT FILES LIST SIZE
184     JLabel mrfLabel = new JLabel("Most recent files list size:");
185     val = ((Integer)god.fHash.get("mrf")).intValue();
186     mrfField = new JTextField(Integer.toString(val), 3);
187     JPanel mrfPanel = new JPanel(new FlowLayout());
188     mrfPanel.add(mrfLabel);
189     mrfPanel.add(mrfField);
190     textPanel.add(mrfPanel);
191     
192     
193     
194     //  MOST RECENT PROJECTS LIST SIZE
195     JLabel mrpLabel = new JLabel("Most recent projects list size:");
196     val = ((Integer)god.fHash.get("mrp")).intValue();
197     mrpField = new JTextField(Integer.toString(val), 3);
198     JPanel mrpPanel = new JPanel(new FlowLayout());
199     mrpPanel.add(mrpLabel);
200     mrpPanel.add(mrpField);
201     textPanel.add(mrpPanel);
202     //  AUTOSAVE
203     autosaveCheck = new JCheckBox("Autosave ", ((Boolean)god.fHash.get("autosave")).booleanValue());
204     JLabel autosave1Label = new JLabel(" every ");
205     autosaveField = new JTextField(Integer.toString(((Integer)god.fHash.get("autosaveTime")).intValue()), 3);
206     autosaveField.setEnabled( ((Boolean)god.fHash.get("autosave")).booleanValue());
207     JLabel autosave2Label = new JLabel(" minutes");
208     JPanel autosavePanel = new JPanel();
209     autosavePanel.add(autosaveCheck);
210     autosavePanel.add(autosave1Label);
211     autosavePanel.add(autosaveField);
212     autosavePanel.add(autosave2Label);
213     
214     autosaveCheck.addActionListener(new ActionListener() {
215       public void actionPerformed(ActionEvent e) {
216     
217         autosaveField.setEnabled(((JToggleButton.ToggleButtonModel)(autosaveCheck.getModel())).isSelected());
218     }});
219     
220     textPanel.add(autosavePanel);
221     
222     
223     
224     
225     
226     //todo:  get/update options from prefs file
227 
228     return textPanel;
229   }
230 
231 public JPanel buildCrlfPanel() {
232     JPanel panel = new JPanel();
233     panel.setLayout( new GridLayout(1, 0) );
234 
235     JPanel savePanel = new JPanel();
236 
237     savePanel.setLayout(new ColumnLayout());
238     savePanel.setBorder( new TitledBorder("Save text file using:") );
239     saveGroup = new ButtonGroup();
240     JRadioButton saveUnix = new JRadioButton("UNIX format");
241     JRadioButton saveDos = new JRadioButton("DOS format");
242     JRadioButton saveAuto = new JRadioButton("original format");
243     
244     saveUnix.getModel().setActionCommand("unix");
245     saveDos.getModel().setActionCommand("dos");
246     saveAuto.getModel().setActionCommand("auto");
247     
248     
249     saveGroup.add(saveUnix);
250     saveGroup.add(saveDos);
251     saveGroup.add(saveAuto);
252     
253     savePanel.add(saveUnix);
254     savePanel.add(saveDos);
255     savePanel.add(saveAuto);
256     
257     saveAuto.setSelected(((String)god.fHash.get("saveType")).equals("auto"));
258     saveUnix.setSelected(((String)god.fHash.get("saveType")).equals("unix"));
259     saveDos.setSelected(((String)god.fHash.get("saveType")).equals("dos"));
260         
261     panel.add(savePanel);
262 /*
263     JPanel autoRespond = new JPanel();
264     autoRespond.setLayout(new ColumnLayout());
265     autoRespond.setBorder( new TitledBorder("Auto Response") );
266 
267     ButtonGroup respondGroup = new ButtonGroup();
268     JRadioButton none = new JRadioButton("None");
269     JRadioButton vaca = new JRadioButton("Send Vacation Message");
270     JRadioButton thx = new JRadioButton("Send Thank You Message");
271 
272     respondGroup.add(none);
273     respondGroup.add(vaca);
274     respondGroup.add(thx);
275 
276     autoRespond.add(none);
277     autoRespond.add(vaca);
278     autoRespond.add(thx);
279 
280     none.setSelected(true);
281     filters.add(autoRespond);
282 */
283     return panel;
284   }
285 
286 
287   public JPanel buildPlafPanel() {
288 
289     JPanel panel = new JPanel();
290     panel.setLayout( new ColumnLayout() );
291     
292     
293     //plaf selection
294     
295     JPanel plafPanel = new JPanel();
296     plafPanel.setBorder( new TitledBorder("Look And Feel") );
297     plafPanel.setLayout(new ColumnLayout());
298 
299 
300     plafGroup = new ButtonGroup();
301     JRadioButton metal = new JRadioButton("Metal");
302     JRadioButton windows = new JRadioButton("Windows");
303     JRadioButton motif = new JRadioButton("Motif");
304 
305     plafGroup.add(metal);
306     plafGroup.add(motif);
307     plafGroup.add(windows);
308     
309     plafPanel.add(metal);
310     plafPanel.add(motif);
311     plafPanel.add(windows);
312     
313     metal.getModel().setActionCommand("metal");
314     windows.getModel().setActionCommand("windows");
315     motif.getModel().setActionCommand("motif");
316           
317     metal.setSelected(((String)god.fHash.get("plaf")).equals("metal"));
318     windows.setSelected(((String)god.fHash.get("plaf")).equals("windows"));
319     motif.setSelected(((String)god.fHash.get("plaf")).equals("motif"));
320     
321     metal.addActionListener(new ActionListener() {
322       public void actionPerformed(ActionEvent ev) { 
323         try {
324           UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
325       god.mainToolbar.setFloatable(true);
326         god.mainToolbar.putClientProperty( "JToolBar.isRollover", Boolean.TRUE );
327         }
328         catch ( UnsupportedLookAndFeelException e ) {
329           System.out.println ("Metal Look & Feel not supported on this platform.");
330 
331         }
332         catch ( IllegalAccessException e ) {
333           System.out.println ("Metal Look & Feel could not be accessed.");
334 
335         }
336         catch ( ClassNotFoundException e ) {
337           System.out.println ("Metal Look & Feel could not found.");
338 
339         }
340         catch ( InstantiationException e ) {
341           System.out.println ("Metal  Look & Feel could not be instantiated.");
342 
343         }
344       }});
345       
346     motif.addActionListener(new ActionListener() {
347       public void actionPerformed(ActionEvent ev) { 
348         try {
349           UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
350       god.mainToolbar.setFloatable(true);
351         god.mainToolbar.putClientProperty( "JToolBar.isRollover", Boolean.TRUE );
352         }
353         catch ( UnsupportedLookAndFeelException e ) {
354           System.out.println (" Motif Look & Feel not supported on this platform.");
355 
356         }
357         catch ( IllegalAccessException e ) {
358           System.out.println (" Motif Look & Feel could not be accessed.");
359 
360         }
361         catch ( ClassNotFoundException e ) {
362           System.out.println (" Motif Look & Feel could not found.");
363 
364         }
365         catch ( InstantiationException e ) {
366           System.out.println ("Motif Look & Feel could not be instantiated. \nProgram Terminated");
367 
368         }
369       }});  
370       
371     windows.addActionListener(new ActionListener() {
372       public void actionPerformed(ActionEvent ev) { 
373         try {
374           UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
375       god.mainToolbar.setFloatable(true);
376         god.mainToolbar.putClientProperty( "JToolBar.isRollover", Boolean.TRUE );
377         }
378         catch ( UnsupportedLookAndFeelException e ) {
379           System.out.println ("Windows Look & Feel not supported on this platform.");
380     
381         }
382         catch ( IllegalAccessException e ) {
383           System.out.println ("Windows Look & Feel could not be accessed.");
384     
385         }
386         catch ( ClassNotFoundException e ) {
387           System.out.println ("Windows Look & Feel could not found.");
388     
389         }
390         catch ( InstantiationException e ) {
391           System.out.println ("Windows Look & Feel could not be instantiated.");
392     
393         } 
394       }})
395       ;
396     
397     
398     //theme selection
399     JPanel themePanel = new JPanel();
400     themePanel.setBorder( new TitledBorder("Theme (Metal only):") );
401     themePanel.setLayout(new ColumnLayout());
402 
403     themeGroup = new ButtonGroup();
404     JRadioButton blue = new JRadioButton("The Dark Sky Of Bucharest");
405     JRadioButton green = new JRadioButton("Green and Restless");
406     JRadioButton contrast = new JRadioButton("Good old ED-011 b&w style");
407     JRadioButton custom = new JRadioButton("custom");   
408     
409     blue.addActionListener(new ActionListener() {
410       public void actionPerformed(ActionEvent ev) { 
411         javax.swing.plaf.metal.MetalLookAndFeel.setCurrentTheme(new javax.swing.plaf.metal.DefaultMetalTheme());
412       }});
413     
414     green.addActionListener(new ActionListener() {
415       public void actionPerformed(ActionEvent ev) { 
416         javax.swing.plaf.metal.MetalLookAndFeel.setCurrentTheme(new CustomMetalTheme(god.theProject.god.fHash));
417       }});
418     
419     contrast.addActionListener(new ActionListener() {
420       public void actionPerformed(ActionEvent ev) { 
421         javax.swing.plaf.metal.MetalLookAndFeel.setCurrentTheme(new CustomMetalTheme(god.fHash));
422     //todo
423     //javax.swing.plaf.metal.MetalLookAndFeel.setCurrentTheme(new ContrastMetalTheme(theProject.god.fHash));
424       }});
425     
426     custom.addActionListener(new ActionListener() {
427       public void actionPerformed(ActionEvent ev) { 
428         //todo
429       }});  
430     
431     
432     blue.getModel().setActionCommand("blue");
433     green.getModel().setActionCommand("green");
434     contrast.getModel().setActionCommand("bw");
435     custom.getModel().setActionCommand("custom"); 
436     
437     blue.setSelected(((String)god.fHash.get("theme")).equals("blue"));
438     green.setSelected(((String)god.fHash.get("theme")).equals("green"));
439     contrast.setSelected(((String)god.fHash.get("theme")).equals("bw"));
440     custom.setSelected(((String)god.fHash.get("theme")).equals("custom"));
441     custom.setEnabled(false);   
442     
443     themeGroup.add(blue);   
444     themeGroup.add(green);
445     themeGroup.add(contrast);
446     themeGroup.add(custom);
447     
448     themePanel.add(blue);
449     themePanel.add(green);
450     themePanel.add(contrast);
451     themePanel.add(custom);
452     
453   
454     panel.add(plafPanel);
455     panel.add(themePanel);
456     
457     return panel;
458   }
459 
460   public JPanel buildVerilogPanel() {
461 
462     JPanel panel = new JPanel();
463     panel.setLayout( new ColumnLayout() );
464     
465     JPanel verilogPanel = new JPanel();
466     verilogPanel.setBorder( new TitledBorder("Verilog interpretor options") );
467     verilogPanel.setLayout(new ColumnLayout());
468 
469     saveBeforeRun = new JCheckBox("Save opened files before run",  ((Boolean)god.fHash.get("saveBeforeRun")).booleanValue());
470     verilogPanel.add(saveBeforeRun);
471     
472     panel.add(verilogPanel);
473 
474     return panel;
475   }
476 
477 
478   public JPanel buildDirectoriesPanel() {
479 
480     JPanel panel = new JPanel();
481     panel.setLayout( new ColumnLayout() );
482     
483     
484     panel.setBorder( new TitledBorder("Directories options") );
485     
486 
487     JTabbedPane dirTabs = new JTabbedPane();
488     
489     includeList = new JList();  //defined as members at the begining of file.
490     modulesList = new JList();
491     
492     //includeList.setEditable(false);
493     //modulesList.setEditable(false);
494     
495     JScrollPane includePane = new JScrollPane( includeList );
496     JScrollPane modulesPane = new JScrollPane( modulesList );
497     
498     //todo: read dirs from prefs
499     
500     dirTabs.addTab("Include directories", null,  includePane );
501     dirTabs.addTab("Precompiled modules directories", null, modulesPane );
502     panel.add(dirTabs);
503     
504     JPanel buttonsPanel = new JPanel();
505     buttonsPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
506     
507     JButton addDirectory = new JButton("Add..");
508     JButton editDirectory = new JButton("Edit..");
509     JButton removeDirectory = new JButton("Remove");
510     
511     addDirectory.addActionListener(new ActionListener() {
512       public void actionPerformed(ActionEvent ev) { 
513         String selDir = new DirectoryChooser(thisPanel, "").getDirectory();   
514       }});
515       
516     editDirectory.addActionListener(new ActionListener() {
517       public void actionPerformed(ActionEvent ev) { 
518         //todo
519         //get active tab -> list
520         //get from list
521         String selDir = new DirectoryChooser(thisPanel, "").getDirectory();   
522         //remove from list
523         //add to list
524       }});
525       
526     removeDirectory.addActionListener(new ActionListener() {
527       public void actionPerformed(ActionEvent ev) { 
528         //todo remove from list
529       }});
530     
531     
532     //editDirectory.setEnabled(false);
533     
534     buttonsPanel.add(addDirectory);
535     buttonsPanel.add(editDirectory);
536     buttonsPanel.add(removeDirectory);
537     
538     panel.add(buttonsPanel);
539     
540     
541     
542     
543     
544     
545     //JComboBox dirSelectCombo = new JComboBox();
546     //dirSelectCombo.addObject("Include directories");
547     //dirSelectCombo.addObject("Precompiled modules directories");
548     
549     //panel.add(choseDirPanel, BorderLayout.NORTH);
550     
551     
552     
553     
554     
555     //saveBeforeRun = new JCheckBox("Save opened files before run",  ((Boolean)god.fHash.get("saveBeforeRun")).booleanValue());
556     //verilogPanel.add(saveBeforeRun);
557     
558     //panel.add(verilogPanel);
559 
560     return panel;
561   }
562 
563 
564 
565 
566 
567 
568   protected void centerDialog() {
569     Dimension screenSize = this.getToolkit().getScreenSize();
570     Dimension size = this.getSize();
571     screenSize.height = screenSize.height/2;
572     screenSize.width = screenSize.width/2;
573     size.height = size.height/2;
574     size.width = size.width/2;
575     int y = screenSize.height - size.height;
576     int x = screenSize.width - size.width;
577     this.setLocation(x,y);
578   }
579 
580 /*  public void CancelPressed() {
581     this.setVisible(false);
582   }
583 */
584   
585   public void CancelPressed() {
586     this.setVisible(false);
587   }
588   
589   public void OKPressed() {
590     //update the prefs file:
591     
592   /*
593   
594 * ButtonGroup indentGroup;
595 * JTextField tabField;
596 * JTextField mrfField;
597 * JTextField mrpField;
598 * JCheckBox autosaveCheck;
599 * JTextField autosaveField;
600 * JCheckBox backupCheck;
601 * JCheckBox loadLastProjectCheck;
602 * JTextField undoField;
603 * ButtonGroup saveGroup;  
604 * ButtonGroup plafGroup;
605 * ButtonGroup themeGroup;
606   
607   
608   JCheckBox saveBeforeRun;
609 
610 */  
611     
612   String tempString;
613   Integer tempInt;
614   
615   god.fHash.put("indentType",indentGroup.getSelection().getActionCommand());  
616   god.fHash.put("save",saveGroup.getSelection().getActionCommand());  
617   god.fHash.put("plaf",plafGroup.getSelection().getActionCommand());  
618   god.fHash.put("theme",themeGroup.getSelection().getActionCommand());  
619   
620   god.fHash.put("autosave", new Boolean(((JToggleButton.ToggleButtonModel)autosaveCheck.getModel()).isSelected()));
621   god.fHash.put("autobackup", new Boolean(((JToggleButton.ToggleButtonModel)backupCheck.getModel()).isSelected()));
622   god.fHash.put("loadLastProject", new Boolean(((JToggleButton.ToggleButtonModel)loadLastProjectCheck.getModel()).isSelected()));
623 
624   god.fHash.put("saveBeforeRun", new Boolean(((JToggleButton.ToggleButtonModel)saveBeforeRun.getModel()).isSelected()));  
625   
626   
627 try {
628 
629   tempString = tabField.getDocument().getText(0, tabField.getDocument().getLength()).trim();
630   try {
631     tempInt = new Integer(tempString);
632     god.fHash.put("tabSize", tempInt); 
633   } catch (NumberFormatException e) {
634     //cannot convert editbox content into Integer
635     //==>  the old value in the preferences is leaved unmodified. 
636   }
637   
638   tempString = mrfField.getDocument().getText(0, mrfField.getDocument().getLength()).trim();
639   try {
640     tempInt = new Integer(tempString);
641     god.fHash.put("mrf", tempInt); 
642   } catch (NumberFormatException e) {
643     //cannot convert editbox content into Integer
644     //==>  the old value in the preferences is leaved unmodified. 
645   }
646   
647   tempString = mrpField.getDocument().getText(0, mrpField.getDocument().getLength()).trim();
648   try {
649     tempInt = new Integer(tempString);
650     god.fHash.put("mrp", tempInt); 
651   } catch (NumberFormatException e) {
652     //cannot convert editbox content into Integer
653     //==>  the old value in the preferences is leaved unmodified. 
654   }
655   
656   tempString = autosaveField.getDocument().getText(0, autosaveField.getDocument().getLength()).trim();
657   try {
658     tempInt = new Integer(tempString);
659     god.fHash.put("autosaveTime", tempInt); 
660   } catch (NumberFormatException e) {
661     //cannot convert editbox content into Integer
662     //==>  the old value in the preferences is leaved unmodified. 
663   }
664   
665   tempString = undoField.getDocument().getText(0, undoField.getDocument().getLength()).trim();
666   try {
667     tempInt = new Integer(tempString);
668     god.fHash.put("undoSize", tempInt); 
669   } catch (NumberFormatException e) {
670     //cannot convert editbox content into Integer
671     //==>  the old value in the preferences is leaved unmodified. 
672   }
673   
674 } catch (javax.swing.text.BadLocationException e) {
675   System.out.println("Fatal exception: BadLocationException");
676   System.out.println("!!!!  I don't know what to do !!!!");
677 } 
678   
679   
680     god.fHash.save();
681     
682     
683     god.fHash.print();
684     
685     //todo:  notify the others for prefs changed.
686     this.setVisible(false);
687   }
688 
689 }
690 
691 class ColumnLayout implements LayoutManager {
692 
693   int xInset = 5;
694   int yInset = 5;
695   int yGap = 2;
696 
697   public void addLayoutComponent(String s, Component c) {}
698 
699   public void layoutContainer(Container c) {
700       Insets insets = c.getInsets();
701       int height = yInset + insets.top;
702 
703       Component[] children = c.getComponents();
704       Dimension compSize = null;
705       for (int i = 0; i < children.length; i++) {
706     compSize = children[i].getPreferredSize();
707     children[i].setSize(compSize.width, compSize.height);
708     children[i].setLocation( xInset + insets.left, height);
709     height += compSize.height + yGap;
710       }
711 
712   }
713 
714   public Dimension minimumLayoutSize(Container c) {
715       Insets insets = c.getInsets();
716       int height = yInset + insets.top;
717       int width = 0 + insets.left + insets.right;
718 
719       Component[] children = c.getComponents();
720       Dimension compSize = null;
721       for (int i = 0; i < children.length; i++) {
722     compSize = children[i].getPreferredSize();
723     height += compSize.height + yGap;
724     width = Math.max(width, compSize.width + insets.left + insets.right + xInset*2);
725       }
726       height += insets.bottom;
727       return new Dimension( width, height);
728   }
729 
730   public Dimension preferredLayoutSize(Container c) {
731       return minimumLayoutSize(c);
732   }
733 
734   public void removeLayoutComponent(Component c) {}
735 
736 }