Source Code Cross Referenced for AppearanceOptionPane.java in  » Swing-Library » jEdit » org » gjt » sp » jedit » options » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Swing Library » jEdit » org.gjt.sp.jedit.options 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * AppearanceOptionPane.java - Appearance options panel
003:         * :tabSize=8:indentSize=8:noTabs=false:
004:         * :folding=explicit:collapseFolds=1:
005:         *
006:         * Copyright (C) 2001, 2004 Slava Pestov
007:         *
008:         * This program is free software; you can redistribute it and/or
009:         * modify it under the terms of the GNU General Public License
010:         * as published by the Free Software Foundation; either version 2
011:         * of the License, or any later version.
012:         *
013:         * This program is distributed in the hope that it will be useful,
014:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016:         * GNU General Public License for more details.
017:         *
018:         * You should have received a copy of the GNU General Public License
019:         * along with this program; if not, write to the Free Software
020:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
021:         */
022:
023:        package org.gjt.sp.jedit.options;
024:
025:        //{{{ Imports
026:        import javax.swing.*;
027:        import java.awt.event.*;
028:        import java.io.*;
029:        import org.gjt.sp.jedit.gui.FontSelector;
030:        import org.gjt.sp.jedit.*;
031:        import org.gjt.sp.util.Log;
032:        import org.gjt.sp.util.IOUtilities;
033:
034:        //}}}
035:
036:        public class AppearanceOptionPane extends AbstractOptionPane {
037:            //{{{ AppearanceOptionPane constructor
038:            public AppearanceOptionPane() {
039:                super ("appearance");
040:            } //}}}
041:
042:            //{{{ _init() method
043:            protected void _init() {
044:                /* Look and feel */
045:                addComponent(new JLabel(jEdit
046:                        .getProperty("options.appearance.lf.note")));
047:
048:                lfs = UIManager.getInstalledLookAndFeels();
049:                String[] names = new String[lfs.length];
050:                String lf = UIManager.getLookAndFeel().getClass().getName();
051:                int index = 0;
052:                for (int i = 0; i < names.length; i++) {
053:                    names[i] = lfs[i].getName();
054:                    if (lf.equals(lfs[i].getClassName()))
055:                        index = i;
056:                }
057:
058:                lookAndFeel = new JComboBox(names);
059:                lookAndFeel.setSelectedIndex(index);
060:                lookAndFeel.addActionListener(new ActionListener() {
061:                    public void actionPerformed(ActionEvent evt) {
062:                        updateEnabled();
063:                    }
064:                });
065:
066:                addComponent(jEdit.getProperty("options.appearance.lf"),
067:                        lookAndFeel);
068:
069:                /* Primary Metal L&F font */
070:                primaryFont = new FontSelector(jEdit
071:                        .getFontProperty("metal.primary.font"));
072:                addComponent(jEdit
073:                        .getProperty("options.appearance.primaryFont"),
074:                        primaryFont);
075:
076:                /* Secondary Metal L&F font */
077:                secondaryFont = new FontSelector(jEdit
078:                        .getFontProperty("metal.secondary.font"));
079:                addComponent(jEdit
080:                        .getProperty("options.appearance.secondaryFont"),
081:                        secondaryFont);
082:
083:                /*
084:                antiAliasExtras = new JComboBox(AntiAlias.comboChoices);
085:                antiAliasExtras.setSelectedIndex(AntiAlias.appearance().val());
086:                antiAliasExtras.setToolTipText(jEdit.getProperty("options.textarea.antiAlias.tooltip"));
087:                addComponent(jEdit.getProperty("options.appearance.fonts.antialias"), antiAliasExtras);
088:                 */
089:                updateEnabled();
090:
091:                /* History count */
092:                history = new JTextField(jEdit.getProperty("history"));
093:                addComponent(jEdit.getProperty("options.appearance.history"),
094:                        history);
095:
096:                /* Menu spillover count */
097:                menuSpillover = new JTextField(jEdit
098:                        .getProperty("menu.spillover"));
099:                addComponent(jEdit
100:                        .getProperty("options.appearance.menuSpillover"),
101:                        menuSpillover);
102:
103:                continuousLayout = new JCheckBox(
104:                        jEdit
105:                                .getProperty("options.appearance.continuousLayout.label"));
106:                continuousLayout.setSelected(jEdit
107:                        .getBooleanProperty("appearance.continuousLayout"));
108:                addComponent(continuousLayout);
109:
110:                addSeparator("options.appearance.startup.label");
111:
112:                /* Show splash screen */
113:                showSplash = new JCheckBox(jEdit
114:                        .getProperty("options.appearance.showSplash"));
115:                String settingsDirectory = jEdit.getSettingsDirectory();
116:                if (settingsDirectory == null)
117:                    showSplash.setSelected(true);
118:                else
119:                    showSplash.setSelected(!new File(settingsDirectory,
120:                            "nosplash").exists());
121:                addComponent(showSplash);
122:
123:                /* Show tip of the day */
124:                showTips = new JCheckBox(jEdit
125:                        .getProperty("options.appearance.showTips"));
126:                showTips.setSelected(jEdit.getBooleanProperty("tip.show"));
127:                addComponent(showTips);
128:
129:                addSeparator("options.appearance.experimental.label");
130:                addComponent(GUIUtilities
131:                        .createMultilineLabel(jEdit
132:                                .getProperty("options.appearance.experimental.caption")));
133:
134:                /* Use jEdit colors in all text components */
135:                textColors = new JCheckBox(jEdit
136:                        .getProperty("options.appearance.textColors"));
137:                textColors.setSelected(jEdit.getBooleanProperty("textColors"));
138:                addComponent(textColors);
139:
140:                /* Decorate frames with look and feel (JDK 1.4 only) */
141:                decorateFrames = new JCheckBox(jEdit
142:                        .getProperty("options.appearance.decorateFrames"));
143:                decorateFrames.setSelected(jEdit
144:                        .getBooleanProperty("decorate.frames"));
145:                addComponent(decorateFrames);
146:
147:                /* Decorate dialogs with look and feel (JDK 1.4 only) */
148:                decorateDialogs = new JCheckBox(jEdit
149:                        .getProperty("options.appearance.decorateDialogs"));
150:                decorateDialogs.setSelected(jEdit
151:                        .getBooleanProperty("decorate.dialogs"));
152:                addComponent(decorateDialogs);
153:            } //}}}
154:
155:            //{{{ _save() method
156:            protected void _save() {
157:                String lf = lfs[lookAndFeel.getSelectedIndex()].getClassName();
158:                jEdit.setProperty("lookAndFeel", lf);
159:                jEdit.setFontProperty("metal.primary.font", primaryFont
160:                        .getFont());
161:                jEdit.setFontProperty("metal.secondary.font", secondaryFont
162:                        .getFont());
163:                jEdit.setProperty("history", history.getText());
164:                jEdit.setProperty("menu.spillover", menuSpillover.getText());
165:                jEdit.setBooleanProperty("tip.show", showTips.isSelected());
166:                jEdit.setBooleanProperty("appearance.continuousLayout",
167:                        continuousLayout.isSelected());
168:
169:                /* AntiAlias nv = AntiAlias.appearance();
170:                 int idx = antiAliasExtras.getSelectedIndex();
171:                nv.set(idx);
172:                primaryFont.setAntiAliasEnabled(idx > 0);
173:                secondaryFont.setAntiAliasEnabled(idx > 0);
174:                primaryFont.repaint();
175:                secondaryFont.repaint(); */
176:
177:                // this is handled a little differently from other jEdit settings
178:                // as the splash screen flag needs to be known very early in the
179:                // startup sequence, before the user properties have been loaded
180:                String settingsDirectory = jEdit.getSettingsDirectory();
181:                if (settingsDirectory != null) {
182:                    File file = new File(settingsDirectory, "nosplash");
183:                    if (showSplash.isSelected())
184:                        file.delete();
185:                    else {
186:                        FileOutputStream out = null;
187:                        try {
188:                            out = new FileOutputStream(file);
189:                            out.write('\n');
190:                            out.close();
191:                        } catch (IOException io) {
192:                            Log.log(Log.ERROR, this , io);
193:                        } finally {
194:                            IOUtilities.closeQuietly(out);
195:                        }
196:                    }
197:                }
198:                jEdit.setBooleanProperty("textColors", textColors.isSelected());
199:                jEdit.setBooleanProperty("decorate.frames", decorateFrames
200:                        .isSelected());
201:                jEdit.setBooleanProperty("decorate.dialogs", decorateDialogs
202:                        .isSelected());
203:            } //}}}
204:
205:            //{{{ Private members
206:
207:            //{{{ Instance variables
208:            private UIManager.LookAndFeelInfo[] lfs;
209:            private JComboBox lookAndFeel;
210:            private FontSelector primaryFont;
211:            private FontSelector secondaryFont;
212:            private JTextField history;
213:            private JTextField menuSpillover;
214:            private JCheckBox showTips;
215:            private JCheckBox continuousLayout;
216:            private JCheckBox showSplash;
217:            private JCheckBox textColors;
218:            private JCheckBox decorateFrames;
219:            private JCheckBox decorateDialogs;
220:            private JComboBox antiAliasExtras;
221:
222:            //}}}
223:
224:            //{{{ updateEnabled() method
225:            private void updateEnabled() {
226:                String className = lfs[lookAndFeel.getSelectedIndex()]
227:                        .getClassName();
228:
229:                if (className.equals("javax.swing.plaf.metal.MetalLookAndFeel")
230:                        || className
231:                                .equals("com.incors.plaf.kunststoff.KunststoffLookAndFeel")) {
232:                    primaryFont.setEnabled(true);
233:                    secondaryFont.setEnabled(true);
234:                } else {
235:                    primaryFont.setEnabled(false);
236:                    secondaryFont.setEnabled(false);
237:                }
238:            } //}}}
239:
240:            //}}}
241:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.