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.wings;
22:
23: import java.awt.BorderLayout;
24: import java.awt.Frame;
25: import java.awt.Graphics;
26: import java.awt.Insets;
27:
28: /**
29: * An extended version of <code>java.awt.Frame</code> that adds support for
30: * the WingS component architecture.
31: * <code>WingFrame</code> contains a
32: * <code>WingRootPane</code> as its only child.<br>
33: * <br>
34: * <b>This class is thread safe.</b>
35: * @see WingRootPane
36: **/
37: public class WingFrame extends Frame {
38: protected final WingRootPane root;
39:
40: /**
41: * Constructs a new instance of <code>Frame</code> that is
42: * initially invisible. The title of the <code>Frame</code>
43: * is empty.
44: **/
45: public WingFrame() {
46: root = new WingRootPane();
47: this .add(root, BorderLayout.CENTER);
48: }
49:
50: /**
51: * Returns the rootPane object for this frame.
52: * @see WingRootPane
53: */
54: public WingRootPane getRootPane() {
55: return root;
56: }
57:
58: /**
59: * Sets the contentPane for this frame.
60: * @see WingRootPane#setContentPane(WingComponent)
61: * @param c the new content pane
62: */
63: public void setContentPane(WingComponent c) {
64: root.setContentPane(c);
65: }
66:
67: /**
68: * Sets the menu bar for this frame.
69: * @param c the menu bar being placed in the frame
70: */
71: public void setMenuBar(WingComponent c) {
72: root.setMenuBar(c);
73: }
74:
75: public void update(Graphics g) {
76: paint(g);
77: }
78:
79: public void paint(Graphics g) {
80: Insets insets = getInsets();
81: g.translate(insets.left, insets.top);
82: root.paint(g);
83: }
84: }
|