|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
TerpWord.java | 50% | 55.6% | 66.7% | 56% |
|
1 |
/*
|
|
2 |
* SimplyHTML, a word processor based on Java, HTML and CSS
|
|
3 |
* Copyright (C) 2002 Ulrich Hilger
|
|
4 |
*
|
|
5 |
* This program is free software; you can redistribute it and/or
|
|
6 |
* modify it under the terms of the GNU General Public License
|
|
7 |
* as published by the Free Software Foundation; either version 2
|
|
8 |
* of the License, or (at your option) any later version.
|
|
9 |
*
|
|
10 |
* This program is distributed in the hope that it will be useful,
|
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
* GNU General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License
|
|
16 |
* along with this program; if not, write to the Free Software
|
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. test
|
|
18 |
*/
|
|
19 |
|
|
20 |
import javax.swing.UIManager;
|
|
21 |
import java.awt.*;
|
|
22 |
import java.util.prefs.*;
|
|
23 |
import javax.swing.ImageIcon;
|
|
24 |
|
|
25 |
/**
|
|
26 |
* Main class of application SimplyHTML.
|
|
27 |
*
|
|
28 |
* <p>This class contains method main and opens the application's main
|
|
29 |
* frame.</p>
|
|
30 |
*
|
|
31 |
* @author Ulrich Hilger
|
|
32 |
* @author Light Development
|
|
33 |
* @author <a href="http://www.lightdev.com">http://www.lightdev.com</a>
|
|
34 |
* @author <a href="mailto:info@lightdev.com">info@lightdev.com</a>
|
|
35 |
* @author published under the terms and conditions of the
|
|
36 |
* GNU General Public License,
|
|
37 |
* for details see file gpl.txt in the distribution
|
|
38 |
* package of this software
|
|
39 |
*
|
|
40 |
* @version stage 11, April 27, 2003
|
|
41 |
*/
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
public class TerpWord { |
|
47 |
FrmMain frame; |
|
48 |
|
|
49 | 73 |
public FrmMain getFrame()
|
50 |
{ |
|
51 | 73 |
return frame;
|
52 |
} |
|
53 |
//Construct the application test
|
|
54 | 74 |
public TerpWord() {
|
55 | 74 |
frame = new FrmMain(); // create an instance of the app's main window |
56 | 74 |
frame.validate(); |
57 |
|
|
58 |
//Center the window
|
|
59 | 74 |
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); |
60 | 74 |
Dimension frameSize = frame.getSize(); |
61 | 74 |
if (frameSize.height > screenSize.height) {
|
62 | 0 |
frameSize.height = screenSize.height; |
63 |
} |
|
64 | 74 |
if (frameSize.width > screenSize.width) {
|
65 | 0 |
frameSize.width = screenSize.width; |
66 |
} |
|
67 | 74 |
frame.setLocation((screenSize.width - frameSize.width) / 2, |
68 |
(screenSize.height - frameSize.height) / 2); |
|
69 |
|
|
70 | 74 |
frame.setVisible(true); // show the window |
71 | 74 |
frame.pack(); |
72 |
} |
|
73 |
//Main method
|
|
74 | 0 |
public static void main(String[] args) { |
75 | 0 |
try {
|
76 | 0 |
Preferences prefs = Preferences.userNodeForPackage( Class.forName("PrefsDialog") );
|
77 | 0 |
UIManager.setLookAndFeel( |
78 |
prefs.get(PrefsDialog.PREFSID_LOOK_AND_FEEL, |
|
79 |
UIManager.getCrossPlatformLookAndFeelClassName())); |
|
80 |
/*
|
|
81 |
The following line causes UIManager to correctly handle alignments
|
|
82 |
of menu items when they do not have an icon.
|
|
83 |
|
|
84 |
At the Java Developer Connection, SKelvin writes:
|
|
85 |
"If the UI class does not find an icon it can't calculate its width :-)
|
|
86 |
It won't work if you just set the property to null (don't ask me
|
|
87 |
why), but setting to any type other than icon works."
|
|
88 |
|
|
89 |
(see http://forum.java.sun.com/thread.jsp?forum=57&thread=126150)
|
|
90 |
*/
|
|
91 |
//UIManager.put("Menu.checkIcon", new ImageIcon("") );
|
|
92 | 0 |
UIManager.put("Menu.checkIcon", UIManager.get("MenuItem.checkIcon") ); |
93 |
} |
|
94 |
catch(Exception e) {
|
|
95 | 0 |
e.printStackTrace(); |
96 |
} |
|
97 | 0 |
new TerpWord();
|
98 |
} |
|
99 |
} |
|