2
* Copyright 2005-2008 Kirill Grouchnikov, based on work by
3
* Sun Microsystems, Inc. All rights reserved.
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Lesser General Public
7
* License as published by the Free Software Foundation; either
8
* version 2.1 of the License, or (at your option) any later version.
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Lesser General Public License for more details.
15
* You should have received a copy of the GNU Lesser General Public
16
* License along with this library; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
import java.awt.BorderLayout;
22
import java.awt.Component;
24
import javax.swing.JCheckBox;
25
import javax.swing.JComboBox;
26
import javax.swing.JFrame;
27
import javax.swing.JList;
28
import javax.swing.JMenu;
29
import javax.swing.JMenuBar;
30
import javax.swing.SwingUtilities;
31
import javax.swing.UIManager;
33
import org.jdesktop.swingx.JXHyperlink;
34
import org.jdesktop.swingx.JXTaskPane;
35
import org.jdesktop.swingx.JXTaskPaneContainer;
36
import org.pushingpixels.substance.api.SubstanceLookAndFeel;
37
import org.pushingpixels.substance.api.SubstanceConstants.MenuGutterFillKind;
38
import org.pushingpixels.substance.api.renderers.SubstanceDefaultListCellRenderer;
39
import org.pushingpixels.substance.api.skin.SubstanceBusinessBlackSteelLookAndFeel;
40
import org.pushingpixels.substance.internal.utils.SubstanceCoreUtilities;
42
import com.jgoodies.forms.builder.DefaultFormBuilder;
43
import com.jgoodies.forms.layout.FormLayout;
45
public class TaskPaneFrame extends JFrame {
46
public TaskPaneFrame() {
47
super("JXTaskPane example");
49
this.setLayout(new BorderLayout());
51
JXTaskPaneContainer container = new JXTaskPaneContainer();
53
JXTaskPane taskPane1 = new JXTaskPane();
54
taskPane1.setTitle("Task pane 1");
55
// taskPane1.setSpecial(true);
56
container.add(taskPane1);
58
FormLayout lm = new FormLayout("right:pref, 4dlu, fill:pref:grow", "");
59
DefaultFormBuilder builder = new DefaultFormBuilder(lm);
61
builder.appendSeparator("Miscellaneous");
63
final JCheckBox useThemedDefaultIconsCheckBox = new JCheckBox(
65
useThemedDefaultIconsCheckBox.setSelected(SubstanceCoreUtilities
66
.useThemedDefaultIcon(null));
67
builder.append("Themed icons", useThemedDefaultIconsCheckBox);
69
final JCheckBox useConstantThemesOnDialogs = new JCheckBox(
71
useConstantThemesOnDialogs.setSelected(SubstanceLookAndFeel
72
.isToUseConstantThemesOnDialogs());
73
builder.append("Pane icons", useConstantThemesOnDialogs);
75
final JComboBox placementCombo = new JComboBox(new Object[] { "top",
76
"bottom", "left", "right" });
77
builder.append("Placement", placementCombo);
79
final JComboBox menuGutterFillCombo = new JComboBox(new Object[] {
80
MenuGutterFillKind.NONE, MenuGutterFillKind.SOFT,
81
MenuGutterFillKind.HARD, MenuGutterFillKind.SOFT_FILL,
82
MenuGutterFillKind.HARD_FILL });
83
menuGutterFillCombo.setRenderer(new SubstanceDefaultListCellRenderer() {
85
public Component getListCellRendererComponent(JList list,
86
Object value, int index, boolean isSelected,
87
boolean cellHasFocus) {
88
MenuGutterFillKind mgfk = (MenuGutterFillKind) value;
89
return super.getListCellRendererComponent(list, mgfk.name()
90
.toLowerCase(), index, isSelected, cellHasFocus);
93
menuGutterFillCombo.setSelectedItem(SubstanceCoreUtilities
94
.getMenuGutterFillKind());
95
builder.append("Menu fill", menuGutterFillCombo);
97
taskPane1.add(builder.getPanel());
99
JXTaskPane taskPane2 = new JXTaskPane();
100
taskPane2.setTitle("Task pane 2");
101
container.add(taskPane2);
103
JXHyperlink link = new JXHyperlink();
104
link.setText("Hyper link");
107
JXTaskPane taskPane3 = new JXTaskPane();
108
taskPane3.setTitle("Collapsed");
109
taskPane3.setCollapsed(true);
110
container.add(taskPane3);
112
this.add(container, BorderLayout.WEST);
114
JMenuBar jmb = new JMenuBar();
115
jmb.add(new JMenu("File"));
116
jmb.add(new JMenu("Edit"));
117
jmb.add(new JMenu("Source"));
118
jmb.add(new JMenu("Refactor"));
119
jmb.add(new JMenu("Navigate"));
120
jmb.add(new JMenu("Search"));
121
jmb.add(new JMenu("Project"));
122
this.setJMenuBar(jmb);
124
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
125
this.setSize(500, 350);
126
this.setLocationRelativeTo(null);
129
public static void main(String[] args) throws Exception {
130
JFrame.setDefaultLookAndFeelDecorated(true);
131
UIManager.setLookAndFeel(new SubstanceBusinessBlackSteelLookAndFeel());
132
// UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
133
SwingUtilities.invokeLater(new Runnable() {
135
new TaskPaneFrame().setVisible(true);