| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
package docrobot; |
| 20 |
|
| 21 |
import java.awt.BorderLayout; |
| 22 |
import java.awt.Component; |
| 23 |
|
| 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; |
| 32 |
|
| 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; |
| 41 |
|
| 42 |
import com.jgoodies.forms.builder.DefaultFormBuilder; |
| 43 |
import com.jgoodies.forms.layout.FormLayout; |
| 44 |
|
| 45 |
public class TaskPaneFrame extends JFrame { |
| 46 |
public TaskPaneFrame() { |
| 47 |
super("JXTaskPane example"); |
| 48 |
|
| 49 |
this.setLayout(new BorderLayout()); |
| 50 |
|
| 51 |
JXTaskPaneContainer container = new JXTaskPaneContainer(); |
| 52 |
|
| 53 |
JXTaskPane taskPane1 = new JXTaskPane(); |
| 54 |
taskPane1.setTitle("Task pane 1"); |
| 55 |
|
| 56 |
container.add(taskPane1); |
| 57 |
|
| 58 |
FormLayout lm = new FormLayout("right:pref, 4dlu, fill:pref:grow", ""); |
| 59 |
DefaultFormBuilder builder = new DefaultFormBuilder(lm); |
| 60 |
|
| 61 |
builder.appendSeparator("Miscellaneous"); |
| 62 |
|
| 63 |
final JCheckBox useThemedDefaultIconsCheckBox = new JCheckBox( |
| 64 |
"themed icons"); |
| 65 |
useThemedDefaultIconsCheckBox.setSelected(SubstanceCoreUtilities |
| 66 |
.useThemedDefaultIcon(null)); |
| 67 |
builder.append("Themed icons", useThemedDefaultIconsCheckBox); |
| 68 |
|
| 69 |
final JCheckBox useConstantThemesOnDialogs = new JCheckBox( |
| 70 |
"constant themes"); |
| 71 |
useConstantThemesOnDialogs.setSelected(SubstanceLookAndFeel |
| 72 |
.isToUseConstantThemesOnDialogs()); |
| 73 |
builder.append("Pane icons", useConstantThemesOnDialogs); |
| 74 |
|
| 75 |
final JComboBox placementCombo = new JComboBox(new Object[] { "top", |
| 76 |
"bottom", "left", "right" }); |
| 77 |
builder.append("Placement", placementCombo); |
| 78 |
|
| 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() { |
| 84 |
@Override |
| 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); |
| 91 |
} |
| 92 |
}); |
| 93 |
menuGutterFillCombo.setSelectedItem(SubstanceCoreUtilities |
| 94 |
.getMenuGutterFillKind()); |
| 95 |
builder.append("Menu fill", menuGutterFillCombo); |
| 96 |
|
| 97 |
taskPane1.add(builder.getPanel()); |
| 98 |
|
| 99 |
JXTaskPane taskPane2 = new JXTaskPane(); |
| 100 |
taskPane2.setTitle("Task pane 2"); |
| 101 |
container.add(taskPane2); |
| 102 |
|
| 103 |
JXHyperlink link = new JXHyperlink(); |
| 104 |
link.setText("Hyper link"); |
| 105 |
taskPane2.add(link); |
| 106 |
|
| 107 |
JXTaskPane taskPane3 = new JXTaskPane(); |
| 108 |
taskPane3.setTitle("Collapsed"); |
| 109 |
taskPane3.setCollapsed(true); |
| 110 |
container.add(taskPane3); |
| 111 |
|
| 112 |
this.add(container, BorderLayout.WEST); |
| 113 |
|
| 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); |
| 123 |
|
| 124 |
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
| 125 |
this.setSize(500, 350); |
| 126 |
this.setLocationRelativeTo(null); |
| 127 |
} |
| 128 |
|
| 129 |
public static void main(String[] args) throws Exception { |
| 130 |
JFrame.setDefaultLookAndFeelDecorated(true); |
| 131 |
UIManager.setLookAndFeel(new SubstanceBusinessBlackSteelLookAndFeel()); |
| 132 |
|
| 133 |
SwingUtilities.invokeLater(new Runnable() { |
| 134 |
public void run() { |
| 135 |
new TaskPaneFrame().setVisible(true); |
| 136 |
} |
| 137 |
}); |
| 138 |
} |
| 139 |
} |