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 java.awt.BorderLayout;
24: import java.awt.GridBagConstraints;
25: import java.awt.GridBagLayout;
26: import java.awt.GridLayout;
27: import java.awt.Insets;
28: import com.javujavu.javux.wings.WingButton;
29: import com.javujavu.javux.wings.WingLabel;
30: import com.javujavu.javux.wings.WingPanel;
31: import com.javujavu.javux.wings.item.LabelItem;
32:
33: public class PanelPanel extends WingPanel {
34: public PanelPanel(WingSetPanel owner) {
35: this .setLayout(new GridBagLayout());
36: WingPanel panel = new WingPanel(new GridLayout(0, 2, 8, 8));
37: GridBagConstraints c = new GridBagConstraints();
38: c.insets = new Insets(10, 10, 10, 10);
39: c.anchor = GridBagConstraints.CENTER;
40: c.fill = GridBagConstraints.BOTH;
41: c.weightx = 1.0;
42: c.weighty = 1.0;
43: this .add(panel, c);
44:
45: WingPanel panel2;
46:
47: panel.add(panel(null));
48: panel.add(panel("border1"));
49: panel.add(panel2 = new WingPanel(new BorderLayout()));
50: panel2.add(panel("border3"));
51: panel2.add(panel("border2"), BorderLayout.NORTH);
52: WingPanel p2;
53: panel.add(p2 = new WingPanel(new GridBagLayout()));
54: WingButton b;
55: p2.add(b = new WingButton("Custom TopStyle"));
56: b.setStyleId("vpopup");
57: b.setTextPosition(LEFT);
58: b.setFastAction(true);
59: b
60: .setTooltip(new LabelItem(
61: "modify TopStyle of this WingPanel\nTopStyle is an extra style overriding stylesheet settings \ndynamically at run time\nclick button to change settings",
62: WingSet.imgIcon, LEFT, RIGHT));
63: new TopStyleEditor(b, p2, 0, 0, 24, 21, false);
64: panel.add(panel("aztec3"));
65: panel.add(panel("aztec"));
66: panel.add(panel("green_icon"));
67: panel.add(panel("red"));
68: }
69:
70: static WingPanel panel(String styleId) {
71: WingPanel r = new WingPanel(new BorderLayout());
72: r.setStyleId(styleId);
73: if (styleId == null)
74: styleId = "";
75: WingLabel l;
76: r.add(l = new WingLabel("Panel Style ID: " + styleId,
77: WingLabel.CENTER));
78: if (styleId.length() > 0)
79: l
80: .setTooltip(new LabelItem(
81: "there's no various borders in Javu WingS\nthese various panels have just background images\npanel style: "
82: + styleId, WingSet.imgMusic));
83:
84: return r;
85: }
86: }
|