001: /*
002: * Javu WingS - Lightweight Java Component Set
003: * Copyright (c) 2005-2007 Krzysztof A. Sadlocha
004: * e-mail: ksadlocha@programics.com
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or (at your option) any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019: */
020:
021: package com.javujavu.javux.demo;
022:
023: import java.awt.BorderLayout;
024: import java.awt.GridBagConstraints;
025: import java.awt.GridBagLayout;
026: import java.awt.Insets;
027: import java.awt.event.ItemEvent;
028: import java.awt.event.ItemListener;
029: import com.javujavu.javux.wings.WingCheckBox;
030: import com.javujavu.javux.wings.WingLabel;
031: import com.javujavu.javux.wings.WingPanel;
032: import com.javujavu.javux.wings.WingSplitPane;
033:
034: public class SplitPanePanel extends WingPanel implements ItemListener {
035: private WingSplitPane spV1;
036: private WingSplitPane spV2;
037: private WingSplitPane spH1;
038: private WingSplitPane spH2;
039: private WingSplitPane spH3;
040: private WingCheckBox cbLayout;
041:
042: public SplitPanePanel(WingSetPanel owner) {
043: this .setLayout(new BorderLayout());
044:
045: spV1 = new WingSplitPane(VERTICAL);
046: spV2 = new WingSplitPane(VERTICAL);
047: spH1 = new WingSplitPane(HORIZONTAL);
048: spH2 = new WingSplitPane(HORIZONTAL);
049: spH2.setStyleId("custom_split");
050: spH3 = new WingSplitPane(HORIZONTAL);
051: spH3.setStyleId("custom_split2");
052: this .add(spV1, BorderLayout.CENTER);
053: spV1.setResizeWeight(0.3);
054: spV1.setTopComponent(spH1);
055: spH1
056: .setLeftComponent(new WingLabel("Panel 1",
057: WingLabel.CENTER));
058: WingPanel p;
059: spH1.setRightComponent(p = new WingPanel(new GridBagLayout()));
060: p.add(cbLayout = new WingCheckBox("continuous layout"));
061: cbLayout.setSelected(true);
062: spH1.setResizeWeight(0.6);
063: spV1.setBottomComponent(spV2);
064: spV2.setTopComponent(spH2);
065: spV2.setResizeWeight(0.5);
066: spH2.setResizeWeight(0.3);
067: WingPanel panel1;
068: spH2.setLeftComponent(panel1 = new WingPanel(
069: new GridBagLayout()));
070: GridBagConstraints c = new GridBagConstraints();
071: c.insets = new Insets(10, 10, 10, 10);
072: c.fill = GridBagConstraints.BOTH;
073: c.weightx = c.weighty = 1;
074: panel1.add(p = new WingPanel(new BorderLayout()), c);
075: WingPanel p2;
076: p.add(p2 = new WingPanel(new BorderLayout()),
077: BorderLayout.NORTH);
078: p2.setStyleId("border2");
079: p2.add(new WingLabel("Panel 3", WingLabel.CENTER));
080: p.add(p2 = new WingPanel(new BorderLayout()));
081: p2.setStyleId("border3");
082: spH2.setRightComponent(panel1 = new WingPanel(
083: new GridBagLayout()));
084: panel1.add(p = new WingPanel(new BorderLayout()), c);
085: p.setStyleId("border1");
086: p.add(new WingLabel("Panel 4", WingLabel.CENTER));
087: spV2.setBottomComponent(spH3);
088: spH3.setResizeWeight(0.6);
089: spH3.setLeftComponent(panel1 = new WingPanel(
090: new GridBagLayout()));
091: c.insets = new Insets(10, 10, 10, 0);
092: panel1.add(p = new WingPanel(new BorderLayout()), c);
093: p.setStyleId("border1alpha");
094: p.add(new WingLabel("Panel 5", WingLabel.CENTER));
095: spH3.setRightComponent(panel1 = new WingPanel(
096: new GridBagLayout()));
097: c.insets = new Insets(10, 0, 10, 10);
098: panel1.add(p = new WingPanel(new BorderLayout()), c);
099: p.setStyleId("border1alpha");
100: p.add(new WingLabel("Panel 6", WingLabel.CENTER));
101:
102: this .addItemListener(this );
103: }
104:
105: public void itemStateChanged(ItemEvent e) {
106: if (e.getSource() == cbLayout) {
107: boolean c = cbLayout.isSelected();
108: spV1.setContinuousLayout(c);
109: spV2.setContinuousLayout(c);
110: spH1.setContinuousLayout(c);
111: spH2.setContinuousLayout(c);
112: spH3.setContinuousLayout(c);
113: }
114: }
115: }
|