KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > rero > dialogs > UIDialog


1 package rero.dialogs;
2
3 import java.awt.*;
4 import java.awt.event.*;
5
6 import javax.swing.*;
7 import javax.swing.table.*;
8 import javax.swing.event.*;
9
10 import java.util.*;
11 import rero.config.*;
12
13 import rero.dck.*;
14 import rero.dck.items.*;
15
16 public class UIDialog extends DMain
17 {
18    protected static boolean NATIVE_DIALOG_SHOWN = false;
19    protected static boolean SDI_DIALOG_SHOWN = false;
20    protected static boolean TAB_DIALOG_SHOWN = false;
21    protected static boolean MENU_DIALOG_SHOWN = false;
22
23    public String JavaDoc getTitle()
24    {
25       return "GUI Setup";
26    }
27
28    public String JavaDoc getDescription()
29    {
30       return "User Interface Options";
31    }
32
33    private static ActionListener preferenceListener = null;
34
35    public void setupDialog()
36    {
37       addBlankSpace();
38       addBlankSpace();
39
40       preferenceListener = new ActionListener()
41       {
42          public void actionPerformed(ActionEvent ev)
43          {
44             if (ClientState.getClientState().isOption("ui.showrestart", ClientDefaults.ui_showrestart))
45             {
46                JOptionPane.showMessageDialog((JComponent)ev.getSource(), "This change in jIRCii's interface\npreferences will not take effect\nuntil you restart jIRCii\n\nUse Alt+O to open the options\ndialog to undo this later", "Interface Setting", JOptionPane.INFORMATION_MESSAGE);
47             }
48          }
49       };
50
51       addDialogGroup(new DGroup("Interface Setup", 30)
52       {
53           public void setupDialog()
54           {
55              CheckboxInput a, b;
56
57              a = addCheckboxInput("ui.native", ClientDefaults.ui_native, "Use native look and feel", 'n');
58              b = addCheckboxInput("ui.sdi", ClientDefaults.ui_sdi, "Use single document interface", 'i');
59              a.getCheckBox().addActionListener(preferenceListener);
60              b.getCheckBox().addActionListener(preferenceListener);
61           }
62       });
63
64       addBlankSpace();
65
66       addDialogGroup(new DGroup("Interface Elements", 30)
67       {
68           public void setupDialog()
69           {
70              CheckboxInput a;
71
72              addCheckboxInput("ui.usetoolbar", ClientDefaults.ui_usetoolbar, "Show newbie toolbar", 's');
73              a = addCheckboxInput("ui.showtabs", ClientDefaults.ui_showtabs, "Show server tabs", 't');
74              addCheckboxInput("ui.showbar", ClientDefaults.ui_showbar, "Show menubar", 'm');
75
76              a.getCheckBox().addActionListener(preferenceListener);
77           }
78       });
79
80       addBlankSpace();
81
82       restartbox = addCheckboxInput("ui.showrestart", ClientDefaults.ui_showrestart, "Show restart required warning dialog", 'r', FlowLayout.CENTER);
83       restartbox.getCheckBox().addActionListener(new ActionListener() {
84          public void actionPerformed(ActionEvent ev)
85          {
86              restartbox.save(); // force an immediate save so this option takes effect right away
87
}
88       });
89    }
90
91    private CheckboxInput restartbox;
92 }
93
94
95
96
Popular Tags