KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > macos > MacOSOptionPane


1 /*
2  * :tabSize=8:indentSize=8:noTabs=false:
3  * :folding=explicit:collapseFolds=1:
4  *
5  * MacOSOptionPane.java - options pane for Mac OS Plugin
6  * Copyright (C) 2002 Kris Kopicki
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21  */

22
23 package macos;
24
25 //{{{ Imports
26
import java.awt.*;
27 import javax.swing.*;
28 import org.gjt.sp.jedit.*;
29 //}}}
30

31 public class MacOSOptionPane extends AbstractOptionPane
32 {
33     //{{{ Variables
34
private JCheckBox menuBox;
35     private JCheckBox preserveBox;
36     private JCheckBox selectionBox;
37     //}}}
38

39     //{{{ Constructor
40
public MacOSOptionPane()
41     {
42         super("MacOSPlugin");
43     }//}}}
44

45     //{{{ _init() method
46
public void _init()
47     {
48         Dimension d = new Dimension(7,7);
49         Dimension d_2 = new Dimension(20,20);
50         
51         menuBox = new JCheckBox(jEdit.getProperty("options.MacOSPlugin.menubar.label"));
52         addComponent(menuBox);
53         addComponent(new JLabel("(Requires restart for changes to take effect)"));
54         
55         addComponent(new Box.Filler(d,d,d));
56         
57         preserveBox = new JCheckBox(jEdit.getProperty("options.MacOSPlugin.preserve.label"));
58         addComponent(preserveBox);
59         
60         addComponent(new Box.Filler(d,d,d));
61         
62         selectionBox = new JCheckBox(jEdit.getProperty("options.MacOSPlugin.useSelection.label"));
63         addComponent(selectionBox);
64         
65         getSettings();
66     }//}}}
67

68     //{{{ _save() method
69
public void _save()
70     {
71         jEdit.setBooleanProperty("MacOSPlugin.useScreenMenuBar", menuBox.isSelected());
72         jEdit.setBooleanProperty("MacOSPlugin.preserveCodes", preserveBox.isSelected());
73         jEdit.setBooleanProperty("MacOSPlugin.useSelection", selectionBox.isSelected());
74     }//}}}
75

76     //{{{ getSettings() method
77
public void getSettings()
78     {
79         menuBox.setSelected(jEdit.getBooleanProperty("MacOSPlugin.useScreenMenuBar",
80             jEdit.getBooleanProperty("MacOSPlugin.default.useScreenMenuBar")));
81         preserveBox.setSelected(jEdit.getBooleanProperty("MacOSPlugin.preserveCodes",
82             jEdit.getBooleanProperty("MacOSPlugin.default.preserveCodes")));
83         selectionBox.setSelected(jEdit.getBooleanProperty("MacOSPlugin.useSelection",
84             jEdit.getBooleanProperty("MacOSPlugin.default.useSelection")));
85     }//}}}
86
}
87
Popular Tags