2 Launch4j (http://launch4j.sourceforge.net/)
3 Cross-platform Java application wrapper for creating Windows native executables.
5 Copyright (C) 2004, 2006 Grzegorz Kowal
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 package net.sf.launch4j.example;
24 import java.awt.Dimension;
25 import java.awt.Toolkit;
26 import java.awt.event.WindowAdapter;
27 import java.awt.event.WindowEvent;
29 import javax.swing.JFrame;
30 import javax.swing.JMenu;
31 import javax.swing.JMenuBar;
32 import javax.swing.JMenuItem;
33 import javax.swing.JOptionPane;
34 import javax.swing.UIManager;
36 public class SimpleApp extends JFrame {
37 public SimpleApp(String[] args) {
38 super("Java Application");
39 final int inset = 100;
40 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
41 setBounds (inset, inset,
42 screenSize.width - inset * 2, screenSize.height - inset * 2);
44 JMenu menu = new JMenu("File");
45 menu.add(new JMenuItem("Open"));
46 menu.add(new JMenuItem("Save"));
47 JMenuBar mb = new JMenuBar();
52 this.addWindowListener(new WindowAdapter() {
53 public void windowClosing(WindowEvent e) {
58 StringBuffer sb = new StringBuffer("Java version: ");
59 sb.append(System.getProperty("java.version"));
60 sb.append("\nJava home: ");
61 sb.append(System.getProperty("java.home"));
62 sb.append("\nCurrent dir: ");
63 sb.append(System.getProperty("user.dir"));
64 if (args.length > 0) {
65 sb.append("\nArgs: ");
66 for (int i = 0; i < args.length; i++) {
71 JOptionPane.showMessageDialog(this,
74 JOptionPane.INFORMATION_MESSAGE);
77 public static void setLAF() {
78 JFrame.setDefaultLookAndFeelDecorated(true);
79 Toolkit.getDefaultToolkit().setDynamicLayout(true);
80 System.setProperty("sun.awt.noerasebackground","true");
82 UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
83 } catch (Exception e) {
84 System.err.println("Failed to set LookAndFeel");
88 public static void main(String[] args) {