Source Code Cross Referenced for QuickNotepadOptionPane.java in  » Swing-Library » jEdit » jars » QuickNotepad » 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 » jars.QuickNotepad 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * QuickNotepadOptionPane.java
003:         * part of the QuickNotepad plugin for the jEdit text editor
004:         * Copyright (C) 2001 John Gellene
005:         * jgellene@nyc.rr.com
006:         *
007:         * This program is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU General Public License
009:         * as published by the Free Software Foundation; either version 2
010:         * of the License, or any later version.
011:         *
012:         * This program is distributed in the hope that it will be useful,
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
015:         * GNU General Public License for more details.
016:         *
017:         * You should have received a copy of the GNU General Public License
018:         * along with this program; if not, write to the Free Software
019:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
020:         *
021:         * $Id: QuickNotepadOptionPane.java 5275 2005-09-10 19:40:17Z ezust $
022:         */
023:
024:        import java.awt.BorderLayout;
025:        import java.awt.Font;
026:        import java.awt.event.ActionEvent;
027:        import java.awt.event.ActionListener;
028:
029:        import javax.swing.JButton;
030:        import javax.swing.JCheckBox;
031:        import javax.swing.JFileChooser;
032:        import javax.swing.JPanel;
033:        import javax.swing.JTextField;
034:
035:        import org.gjt.sp.jedit.AbstractOptionPane;
036:        import org.gjt.sp.jedit.GUIUtilities;
037:        import org.gjt.sp.jedit.jEdit;
038:        import org.gjt.sp.jedit.gui.FontSelector;
039:
040:        public class QuickNotepadOptionPane extends AbstractOptionPane
041:                implements  ActionListener {
042:            private JCheckBox showPath;
043:
044:            private JTextField pathName;
045:
046:            private FontSelector font;
047:
048:            public QuickNotepadOptionPane() {
049:                super (QuickNotepadPlugin.NAME);
050:            }
051:
052:            public void _init() {
053:                showPath = new JCheckBox(jEdit
054:                        .getProperty(QuickNotepadPlugin.OPTION_PREFIX
055:                                + "show-filepath.title"), jEdit.getProperty(
056:                        QuickNotepadPlugin.OPTION_PREFIX + "show-filepath")
057:                        .equals("true"));
058:                addComponent(showPath);
059:
060:                pathName = new JTextField(jEdit
061:                        .getProperty(QuickNotepadPlugin.OPTION_PREFIX
062:                                + "filepath"));
063:                JButton pickPath = new JButton(jEdit
064:                        .getProperty(QuickNotepadPlugin.OPTION_PREFIX
065:                                + "choose-file"));
066:                pickPath.addActionListener(this );
067:
068:                JPanel pathPanel = new JPanel(new BorderLayout(0, 0));
069:                pathPanel.add(pathName, BorderLayout.CENTER);
070:                pathPanel.add(pickPath, BorderLayout.EAST);
071:
072:                addComponent(jEdit.getProperty(QuickNotepadPlugin.OPTION_PREFIX
073:                        + "file"), pathPanel);
074:
075:                font = new FontSelector(makeFont());
076:                addComponent(jEdit.getProperty(QuickNotepadPlugin.OPTION_PREFIX
077:                        + "choose-font"), font);
078:            }
079:
080:            public void _save() {
081:                jEdit.setProperty(
082:                        QuickNotepadPlugin.OPTION_PREFIX + "filepath", pathName
083:                                .getText());
084:                Font _font = font.getFont();
085:                jEdit.setProperty(QuickNotepadPlugin.OPTION_PREFIX + "font",
086:                        _font.getFamily());
087:                jEdit.setProperty(
088:                        QuickNotepadPlugin.OPTION_PREFIX + "fontsize", String
089:                                .valueOf(_font.getSize()));
090:                jEdit.setProperty(QuickNotepadPlugin.OPTION_PREFIX
091:                        + "fontstyle", String.valueOf(_font.getStyle()));
092:                jEdit.setProperty(QuickNotepadPlugin.OPTION_PREFIX
093:                        + "show-filepath", String
094:                        .valueOf(showPath.isSelected()));
095:            }
096:
097:            // end AbstractOptionPane implementation
098:
099:            // begin ActionListener implementation
100:            public void actionPerformed(ActionEvent evt) {
101:                String[] paths = GUIUtilities.showVFSFileDialog(null, null,
102:                        JFileChooser.OPEN_DIALOG, false);
103:                if (paths != null) {
104:                    pathName.setText(paths[0]);
105:                }
106:            }
107:
108:            // helper method to get Font from plugin properties
109:            static public Font makeFont() {
110:                int style, size;
111:                String family = jEdit
112:                        .getProperty(QuickNotepadPlugin.OPTION_PREFIX + "font");
113:                try {
114:                    size = Integer.parseInt(jEdit
115:                            .getProperty(QuickNotepadPlugin.OPTION_PREFIX
116:                                    + "fontsize"));
117:                } catch (NumberFormatException nf) {
118:                    size = 14;
119:                }
120:                try {
121:                    style = Integer.parseInt(jEdit
122:                            .getProperty(QuickNotepadPlugin.OPTION_PREFIX
123:                                    + "fontstyle"));
124:                } catch (NumberFormatException nf) {
125:                    style = Font.PLAIN;
126:                }
127:                return new Font(family, style, size);
128:            }
129:
130:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.