001: /*
002: * Copyright 2005-2008 Kirill Grouchnikov, based on work by
003: * Sun Microsystems, Inc. All rights reserved.
004: *
005: * This library is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU Lesser General Public
007: * License as published by the Free Software Foundation; either
008: * version 2.1 of the License, or (at your option) any later version.
009: *
010: * This library is distributed in the hope that it will be useful,
011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013: * Lesser General Public License for more details.
014: *
015: * You should have received a copy of the GNU Lesser General Public
016: * License along with this library; if not, write to the Free Software
017: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
018: */
019: package docrobot;
020:
021: import java.awt.BorderLayout;
022: import java.awt.Component;
023:
024: import javax.swing.*;
025:
026: import org.jdesktop.swingx.*;
027: import org.jvnet.substance.SubstanceDefaultListCellRenderer;
028: import org.jvnet.substance.SubstanceLookAndFeel;
029: import org.jvnet.substance.skin.SubstanceBusinessBlackSteelLookAndFeel;
030: import org.jvnet.substance.utils.SubstanceCoreUtilities;
031: import org.jvnet.substance.utils.SubstanceConstants.MenuGutterFillKind;
032:
033: import com.jgoodies.forms.builder.DefaultFormBuilder;
034: import com.jgoodies.forms.layout.FormLayout;
035:
036: public class TaskPaneFrame extends JFrame {
037: public TaskPaneFrame() {
038: super ("JXTaskPane example");
039:
040: this .setLayout(new BorderLayout());
041:
042: JXTaskPaneContainer container = new JXTaskPaneContainer();
043:
044: JXTaskPane taskPane1 = new JXTaskPane();
045: taskPane1.setTitle("Task pane 1");
046: // taskPane1.setSpecial(true);
047: container.add(taskPane1);
048:
049: FormLayout lm = new FormLayout(
050: "right:pref, 4dlu, fill:pref:grow", "");
051: DefaultFormBuilder builder = new DefaultFormBuilder(lm);
052:
053: builder.appendSeparator("Miscellaneous");
054:
055: final JCheckBox useThemedDefaultIconsCheckBox = new JCheckBox(
056: "themed icons");
057: useThemedDefaultIconsCheckBox
058: .setSelected(SubstanceCoreUtilities
059: .useThemedDefaultIcon(null));
060: builder.append("Themed icons", useThemedDefaultIconsCheckBox);
061:
062: final JCheckBox useConstantThemesOnDialogs = new JCheckBox(
063: "constant themes");
064: useConstantThemesOnDialogs.setSelected(SubstanceLookAndFeel
065: .isToUseConstantThemesOnDialogs());
066: builder.append("Pane icons", useConstantThemesOnDialogs);
067:
068: final JComboBox placementCombo = new JComboBox(new Object[] {
069: "top", "bottom", "left", "right" });
070: builder.append("Placement", placementCombo);
071:
072: final JComboBox menuGutterFillCombo = new JComboBox(
073: new Object[] { MenuGutterFillKind.NONE,
074: MenuGutterFillKind.SOFT,
075: MenuGutterFillKind.HARD,
076: MenuGutterFillKind.SOFT_FILL,
077: MenuGutterFillKind.HARD_FILL });
078: menuGutterFillCombo
079: .setRenderer(new SubstanceDefaultListCellRenderer() {
080: @Override
081: public Component getListCellRendererComponent(
082: JList list, Object value, int index,
083: boolean isSelected, boolean cellHasFocus) {
084: MenuGutterFillKind mgfk = (MenuGutterFillKind) value;
085: return super .getListCellRendererComponent(list,
086: mgfk.name().toLowerCase(), index,
087: isSelected, cellHasFocus);
088: }
089: });
090: menuGutterFillCombo.setSelectedItem(SubstanceCoreUtilities
091: .getMenuGutterFillKind());
092: builder.append("Menu fill", menuGutterFillCombo);
093:
094: taskPane1.add(builder.getPanel());
095:
096: JXTaskPane taskPane2 = new JXTaskPane();
097: taskPane2.setTitle("Task pane 2");
098: container.add(taskPane2);
099:
100: JXHyperlink link = new JXHyperlink();
101: link.setText("Hyper link");
102: taskPane2.add(link);
103:
104: JXTaskPane taskPane3 = new JXTaskPane();
105: taskPane3.setTitle("Collapsed");
106: taskPane3.setExpanded(false);
107: container.add(taskPane3);
108:
109: this .add(container, BorderLayout.WEST);
110:
111: JMenuBar jmb = new JMenuBar();
112: jmb.add(new JMenu("File"));
113: jmb.add(new JMenu("Edit"));
114: jmb.add(new JMenu("Source"));
115: jmb.add(new JMenu("Refactor"));
116: jmb.add(new JMenu("Navigate"));
117: jmb.add(new JMenu("Search"));
118: jmb.add(new JMenu("Project"));
119: this .setJMenuBar(jmb);
120:
121: this .setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
122: this .setSize(500, 350);
123: this .setLocationRelativeTo(null);
124: }
125:
126: public static void main(String[] args) throws Exception {
127: JFrame.setDefaultLookAndFeelDecorated(true);
128: UIManager
129: .setLookAndFeel(new SubstanceBusinessBlackSteelLookAndFeel());
130: // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
131: SwingUtilities.invokeLater(new Runnable() {
132: public void run() {
133: new TaskPaneFrame().setVisible(true);
134: }
135: });
136: }
137: }
|