01: /*
02: * Javu WingS - Lightweight Java Component Set
03: * Copyright (c) 2005-2007 Krzysztof A. Sadlocha
04: * e-mail: ksadlocha@programics.com
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or (at your option) any later version.
10: *
11: * This library 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 GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19: */
20:
21: package helloworld;
22:
23: import java.awt.GridBagLayout;
24: import java.awt.event.WindowAdapter;
25: import java.awt.event.WindowEvent;
26: import com.javujavu.javux.wings.WingButton;
27: import com.javujavu.javux.wings.WingFrame;
28: import com.javujavu.javux.wings.WingPanel;
29: import com.javujavu.javux.wings.WingSkin;
30:
31: public class HelloWorld {
32: public static void main(String[] args) {
33: // at first load skin !
34: // from directory skin/green relative to class file of HelloWorld
35: WingSkin.loadSkin("/skin/green", true, HelloWorld.class);
36:
37: // build simple content panel
38: WingPanel panel = new WingPanel(new GridBagLayout());
39: // with one button
40: panel.add(new WingButton("Hello World"));
41:
42: // and finally show it in frame
43: final WingFrame frame = new WingFrame();
44: frame.setContentPane(panel);
45:
46: frame.setTitle("Hello World");
47:
48: frame.addWindowListener(new WindowAdapter() {
49: public void windowClosing(WindowEvent e) {
50: System.exit(0);
51: }
52: });
53:
54: frame.pack();
55: frame.setSize(200, 150);
56: frame.setLocation(100, 100);
57: frame.setVisible(true);
58: }
59: }
|