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.FlowLayout;
24: import java.awt.LayoutManager;
25: import java.awt.Point;
26:
27: /**
28: * <code>WingPanel</code> is the container class
29: * in which an application can attach any other
30: * component, including other panels.
31: * <br>
32: * <b>This class is thread safe.</b>
33: **/
34: public class WingPanel extends WingComponent {
35: /**
36: * Creates a new panel using <code>FlowLayout</code> class as the layout manager.
37: */
38: public WingPanel() {
39: this (new FlowLayout());
40: }
41:
42: /**
43: * Creates a new panel with the specified layout manager.
44: * @param lm the layout manager for this panel.
45: */
46: public WingPanel(LayoutManager lm) {
47: setLayout(lm);
48: }
49:
50: /**
51: * Loads skin resources.<br>
52: * <pre>
53: * styles:
54: * [optional styleID.]panel.normal
55: * [optional styleID.]panel.disabled
56: * </pre>
57: * @see Style
58: * @see WingSkin
59: */
60: public void loadSkin() {
61: stNormal = WingSkin.getStyle(styleId, "panel", NORMAL, null);
62: stDisabled = WingSkin.getStyle(styleId, "panel", DISABLED,
63: stNormal).merge(stTop);
64: stNormal = stNormal.merge(stTop);
65: }
66:
67: /**
68: * @see com.javujavu.javux.wings.WingComponent#getScrollIncrements(java.awt.Point, java.awt.Point)
69: */
70: public void getScrollIncrements(Point unit, Point block) {
71: super .getScrollIncrements(unit, block);
72: WingFont font = getWingFont();
73: unit.x = font.stringWidth("O");
74: unit.y = font.getHeight();
75: }
76: }
|