KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > taskblocks > app > TaskBlocks


1 /*
2  * Copyright (C) Jakub Neubauer, 2007
3  *
4  * This file is part of TaskBlocks
5  *
6  * TaskBlocks is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * TaskBlocks is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */

19
20 package taskblocks.app;
21
22 import java.io.File JavaDoc;
23 import java.net.URL JavaDoc;
24
25 import javax.swing.ImageIcon JavaDoc;
26 import javax.swing.SwingUtilities JavaDoc;
27
28 public class TaskBlocks {
29
30     static final boolean RUNNING_ON_MAC = System.getProperty("os.name")
31             .toLowerCase().startsWith("mac os x");
32
33     static final boolean RUNNING_ON_WINDOWS = System.getProperty("os.name")
34             .toLowerCase().startsWith("windows");
35
36     public TaskBlocks(final String JavaDoc[] args) {
37
38         System.setProperty("apple.laf.useScreenMenuBar", "true");
39         System.setProperty("com.apple.mrj.application.growbox.intrudes",
40                 "false");
41         System.setProperty("com.apple.mrj.application.live-resize", "true");
42
43         SwingUtilities.invokeLater(new Runnable JavaDoc() {
44             public void run() {
45                 if (args.length > 0) {
46                     for (int i = 0; i < args.length; i++) {
47                         new ProjectFrame().openFile(new File JavaDoc(args[i]));
48                     }
49                 } else {
50                     new ProjectFrame();
51                 }
52             }
53         });
54     }
55
56     public static void main(String JavaDoc args[]) {
57         new TaskBlocks(args);
58     }
59
60     public static ImageIcon JavaDoc getImage(String JavaDoc name) {
61         URL JavaDoc url = ProjectFrame.class.getResource("/taskblocks/img/" + name);
62         if (url == null) {
63             return null;
64         }
65         return new ImageIcon JavaDoc(url);
66     }
67
68 }
69
Popular Tags