Initial commit of newLISP.
[newlisp.git] / guiserver / java / WindowWidget.java
blob0b157dd845c6a42a159e988c6b1ed64acae6e353
1 //
2 // WindowWidget.java
3 // guiserver
4 //
5 // Created by Lutz Mueller on 6/16/07.
6 //
7 //
8 // Copyright (C) 2007 Lutz Mueller
9 //
10 // This program is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
15 // This program is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
20 // You should have received a copy of the GNU General Public License
21 // along with this program. If not, see <http://www.gnu.org/licenses/>.
25 import java.awt.*;
26 import java.awt.color.*;
27 import java.awt.event.*;
28 import java.util.*;
29 import java.io.*;
31 @SuppressWarnings("unchecked")
32 public class WindowWidget extends gsObject {
34 Window window;
35 Frame frame;
37 public WindowWidget(StringTokenizer params)
39 id = params.nextToken();
41 frame = new Frame();
42 window = new Window(frame);
43 component = window;
44 container = window;
46 int x = Integer.parseInt(params.nextToken());
47 int y = Integer.parseInt(params.nextToken());
48 int width = Integer.parseInt(params.nextToken());
49 int height = Integer.parseInt(params.nextToken());
51 window.setBounds(x, y, width, height);
53 gsObject.widgets.put(id, this);
57 public void setBackground(StringTokenizer tokens)
59 Float red = Float.parseFloat(tokens.nextToken());
60 Float green = Float.parseFloat(tokens.nextToken());
61 Float blue = Float.parseFloat(tokens.nextToken());
62 if(tokens.hasMoreTokens())
64 Float alpha = Float.parseFloat(tokens.nextToken());
65 component.setBackground(new Color(red, green, blue, alpha));
67 else
68 component.setBackground(new Color(red, green, blue));
71 public void dispose(StringTokenizer tokens)
73 window.dispose();
74 frame.dispose();
77 public void setFont(StringTokenizer tokens)
79 ErrorDialog.wrongApplication(Dispatcher.cmd, id);
82 public void setToolTip(StringTokenizer tokens)
84 ErrorDialog.wrongApplication(Dispatcher.cmd, id);
87 public void setTitledBorder(StringTokenizer tokens)
89 ErrorDialog.wrongApplication(Dispatcher.cmd, id);
92 public void setBevelBorder(StringTokenizer tokens)
94 ErrorDialog.wrongApplication(Dispatcher.cmd, id);
97 public void getBounds(StringTokenizer tokens)
99 int x, y, width, height;
101 x = frame.getLocationOnScreen().x;
102 y = frame.getLocationOnScreen().y;
104 width = frame.getWidth();
105 height = frame.getHeight();
107 guiserver.out.println("( set 'gs:bounds '(" + x + " " + y + " " + width + " " + height + "))\n");
108 guiserver.out.flush();
114 // eof //