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 com.javujavu.javux.demo;
22:
23: import com.javujavu.javux.wings.WingApplet;
24:
25: public class WingSetApplet extends WingApplet {
26: boolean running;
27:
28: public void start() {
29: if (!running)
30: startApplet();
31: running = true;
32: }
33:
34: public void stop() {
35: if (running)
36: stopApplet();
37: running = false;
38: }
39:
40: public void destroy() {
41: if (running)
42: stopApplet();
43: running = false;
44: }
45:
46: public void startApplet() {
47: System.out.println("getDocumentBase " + getDocumentBase());
48: System.out.println("getCodeBase " + getCodeBase());
49:
50: String s = getCodeBase().toString();
51: if (!s.endsWith("/"))
52: s = s + "/";
53: String skinPath = getParameter("skinPath");
54: if (skinPath != null)
55: s = s + skinPath + "/";
56: final String path = s;
57: (new Thread(new Runnable() {
58: public void run() {
59: WingSet.initApplet(path, getRootPane(),
60: getParameter("skin"));
61: }
62: })).start();
63: }
64:
65: public void stopApplet() {
66: WingSetPanel panel = WingSetPanel.the;
67: if (panel != null) {
68: WingSetPanel.the = null;
69: panel.stopThread();
70: setContentPane(null);
71: }
72: }
73: }
|