Browse Source

migrate demos to MigLayout

Signed-off-by: weisj <weisj@arcor.de>
pull/60/head
weisj 5 years ago
parent
commit
b92eae10ae
  1. 38
      core/src/test/java/ui/button/ButtonDemo.java
  2. 28
      core/src/test/java/ui/button/ToggleButtonDemo.java
  3. 3
      core/src/test/java/ui/checkBox/CheckBoxDemo.java
  4. 3
      core/src/test/java/ui/checkBox/TriCheckBoxDemo.java
  5. 3
      core/src/test/java/ui/comboBox/ComboBoxDemo.java
  6. 6
      core/src/test/java/ui/list/ListDemo.java
  7. 3
      core/src/test/java/ui/progressBar/ProgressBarDemo.java
  8. 3
      core/src/test/java/ui/radioButton/RadioButtonDemo.java
  9. 6
      core/src/test/java/ui/scrollPane/ScrollPaneDemo.java
  10. 22
      core/src/test/java/ui/slider/SliderDemo.java
  11. 4
      core/src/test/java/ui/spinner/SpinnerDemo.java
  12. 3
      core/src/test/java/ui/splitPane/SplitPaneDemo.java
  13. 30
      core/src/test/java/ui/tabbedPane/TabbedPaneDemo.java
  14. 3
      core/src/test/java/ui/table/TableDemo.java
  15. 3
      core/src/test/java/ui/text/PasswordFieldDemo.java
  16. 4
      core/src/test/java/ui/text/TextComponentDemo.java
  17. 3
      core/src/test/java/ui/text/TextFieldDemo.java
  18. 6
      core/src/test/java/ui/tree/TreeDemo.java

38
core/src/test/java/ui/button/ButtonDemo.java

@ -24,6 +24,7 @@
package ui.button;
import com.github.weisj.darklaf.icons.IconLoader;
import net.miginfocom.swing.MigLayout;
import ui.ComponentDemo;
import ui.DemoPanel;
import ui.QuickColorChooser;
@ -43,7 +44,7 @@ public class ButtonDemo implements ComponentDemo {
JButton button = new JButton("Test Button", icon);
DemoPanel panel = new DemoPanel(button);
JPanel controlPanel = panel.getControls();
controlPanel.setLayout(new GridLayout(6, 2));
controlPanel.setLayout(new MigLayout("fillx, wrap 2", "[][grow]"));
controlPanel.add(new JCheckBox("enabled") {{
setSelected(button.isEnabled());
addActionListener(e -> button.setEnabled(isSelected()));
@ -74,32 +75,29 @@ public class ButtonDemo implements ComponentDemo {
setSelected(false);
addActionListener(e -> button.putClientProperty("JButton.alternativeArc", isSelected()));
}});
controlPanel.add(new JCheckBox("Button.defaultButtonFollowsFocus") {{
setSelected(UIManager.getBoolean("Button.defaultButtonFollowsFocus"));
addActionListener(e -> UIManager.put("Button.defaultButtonFollowsFocus", isSelected()));
}});
controlPanel.add(new QuickColorChooser("JButton.shadow.hover", Color.BLACK,
(b, c) -> button.putClientProperty("JButton.shadow.hover", b ? c : null)));
controlPanel.add(new QuickColorChooser("JButton.shadow.click", Color.BLACK,
(b, c) -> button.putClientProperty("JButton.shadow.click", b ? c : null)));
controlPanel.add(new JLabel("JButton.variant"));
controlPanel.add(new JComboBox<String>() {{
addItem("JButton.variant = onlyLabel");
addItem("JButton.variant = shadow");
addItem("JButton.variant = fullShadow");
addItem("no JButton.variant");
addItem("onlyLabel");
addItem("shadow");
addItem("fullShadow");
addItem("none");
setSelectedItem("no JButton.variant");
addItemListener(e -> {
if (e.getItem().equals("JButton.variant = onlyLabel")) {
button.putClientProperty("JButton.variant", "onlyLabel");
} else if (e.getItem().equals("JButton.variant = shadow")) {
button.putClientProperty("JButton.variant", "shadow");
} else if (e.getItem().equals("JButton.variant = fullShadow")) {
button.putClientProperty("JButton.variant", "fullShadow");
} else {
if (e.getItem().equals("none")) {
button.putClientProperty("JButton.variant", null);
} else {
button.putClientProperty("JButton.variant", e.getItem());
}
});
}});
controlPanel.add(new QuickColorChooser("JButton.shadow.hover", Color.BLACK,
(b, c) -> button.putClientProperty("JButton.shadow.hover", b ? c : null)));
controlPanel.add(new QuickColorChooser("JButton.shadow.click", Color.BLACK,
(b, c) -> button.putClientProperty("JButton.shadow.click", b ? c : null)));
controlPanel.add(new JCheckBox("Button.defaultButtonFollowsFocus") {{
setSelected(UIManager.getBoolean("Button.defaultButtonFollowsFocus"));
addActionListener(e -> UIManager.put("Button.defaultButtonFollowsFocus", isSelected()));
}});
return panel;
}

28
core/src/test/java/ui/button/ToggleButtonDemo.java

@ -24,6 +24,7 @@
package ui.button;
import com.github.weisj.darklaf.icons.IconLoader;
import net.miginfocom.swing.MigLayout;
import ui.ComponentDemo;
import ui.DemoPanel;
@ -42,7 +43,7 @@ public class ToggleButtonDemo implements ComponentDemo {
JToggleButton button = new JToggleButton("Test ToggleButton", icon);
DemoPanel panel = new DemoPanel(button);
JPanel controlPanel = panel.getControls();
controlPanel.setLayout(new GridLayout(3, 2));
controlPanel.setLayout(new MigLayout("fillx, wrap 2", "[][grow]"));
controlPanel.add(new JCheckBox("enabled") {{
setSelected(button.isEnabled());
addActionListener(e -> button.setEnabled(isSelected()));
@ -52,30 +53,31 @@ public class ToggleButtonDemo implements ComponentDemo {
addActionListener(e -> button.setComponentOrientation(isSelected() ? ComponentOrientation.LEFT_TO_RIGHT
: ComponentOrientation.RIGHT_TO_LEFT));
}});
controlPanel.add(new JCheckBox("JToggleButton.isTreeCellEditor") {{
setSelected(false);
addActionListener(e -> button.putClientProperty("JToggleButton.isTreeCellEditor", isSelected()));
}});
controlPanel.add(new JCheckBox("JToggleButton.isTableCellEditor") {{
setSelected(false);
addActionListener(e -> button.putClientProperty("JToggleButton.isTableCellEditor", isSelected()));
}});
controlPanel.add(new JCheckBox("Rollover") {{
setSelected(button.isRolloverEnabled());
addActionListener(e -> button.setRolloverEnabled(isSelected()));
}});
}}, "span");
controlPanel.add(new JLabel("JToggleButton.variant"));
controlPanel.add(new JComboBox<String>() {{
addItem("JToggleButton.variant = slider");
addItem("no JToggleButton.variant");
addItem("slider");
addItem("none");
setSelectedItem("no JToggleButton.variant");
addItemListener(e -> {
if (e.getItem().equals("JToggleButton.variant = slider")) {
if (e.getItem().equals("slider")) {
button.putClientProperty("JToggleButton.variant", "slider");
} else {
button.putClientProperty("JToggleButton.variant", null);
}
});
}});
controlPanel.add(new JCheckBox("JToggleButton.isTreeCellEditor") {{
setSelected(false);
addActionListener(e -> button.putClientProperty("JToggleButton.isTreeCellEditor", isSelected()));
}});
controlPanel.add(new JCheckBox("JToggleButton.isTableCellEditor") {{
setSelected(false);
addActionListener(e -> button.putClientProperty("JToggleButton.isTableCellEditor", isSelected()));
}});
return panel;
}

3
core/src/test/java/ui/checkBox/CheckBoxDemo.java

@ -23,6 +23,7 @@
*/
package ui.checkBox;
import net.miginfocom.swing.MigLayout;
import ui.ComponentDemo;
import ui.DemoPanel;
@ -40,7 +41,7 @@ public class CheckBoxDemo implements ComponentDemo {
JCheckBox button = new JCheckBox("Test CheckBox");
DemoPanel panel = new DemoPanel(button);
JPanel controlPanel = panel.getControls();
controlPanel.setLayout(new GridLayout(2, 2));
controlPanel.setLayout(new MigLayout("fillx, wrap 1", "[][grow]"));
controlPanel.add(new JCheckBox("enabled") {{
setSelected(button.isEnabled());
addActionListener(e -> button.setEnabled(isSelected()));

3
core/src/test/java/ui/checkBox/TriCheckBoxDemo.java

@ -24,6 +24,7 @@
package ui.checkBox;
import com.github.weisj.darklaf.components.tristate.TristateCheckBox;
import net.miginfocom.swing.MigLayout;
import ui.ComponentDemo;
import ui.DemoPanel;
@ -41,7 +42,7 @@ public class TriCheckBoxDemo implements ComponentDemo {
TristateCheckBox button = new TristateCheckBox("Test TriCheckBox");
DemoPanel panel = new DemoPanel(button);
JPanel controlPanel = panel.getControls();
controlPanel.setLayout(new GridLayout(3, 2));
controlPanel.setLayout(new MigLayout("fillx, wrap 1", "[][grow]"));
controlPanel.add(new JCheckBox("enabled") {{
setSelected(button.isEnabled());
addActionListener(e -> button.setEnabled(isSelected()));

3
core/src/test/java/ui/comboBox/ComboBoxDemo.java

@ -23,6 +23,7 @@
*/
package ui.comboBox;
import net.miginfocom.swing.MigLayout;
import ui.ComponentDemo;
import ui.DemoPanel;
@ -43,7 +44,7 @@ public class ComboBoxDemo implements ComponentDemo {
}
DemoPanel panel = new DemoPanel(comboBox);
JPanel controlPanel = panel.getControls();
controlPanel.setLayout(new GridLayout(3, 2));
controlPanel.setLayout(new MigLayout("fillx, wrap 1", "[][grow]"));
controlPanel.add(new JCheckBox("enabled") {{
setSelected(comboBox.isEnabled());
addActionListener(e -> comboBox.setEnabled(isSelected()));

6
core/src/test/java/ui/list/ListDemo.java

@ -23,6 +23,7 @@
*/
package ui.list;
import net.miginfocom.swing.MigLayout;
import ui.ComponentDemo;
import ui.DemoPanel;
@ -45,12 +46,11 @@ public final class ListDemo implements ComponentDemo {
list.setSelectedIndex(2);
DemoPanel panel = new DemoPanel(list, new BorderLayout());
JPanel controlPanel = panel.getControls();
controlPanel.setLayout(new GridLayout(3, 2));
controlPanel.add(new JLabel());
controlPanel.setLayout(new MigLayout("fillx, wrap 2", "[][grow]"));
controlPanel.add(new JCheckBox("JList.alternateRowColor") {{
setSelected(Boolean.TRUE.equals(list.getClientProperty("JList.alternateRowColor")));
addActionListener(e -> list.putClientProperty("JList.alternateRowColor", isSelected()));
}});
}}, "span");
controlPanel.add(new JLabel("Layout orientation:", JLabel.RIGHT));
controlPanel.add(new JComboBox<String>() {{
Map<String, Integer> mapping = new HashMap<String, Integer>() {{

3
core/src/test/java/ui/progressBar/ProgressBarDemo.java

@ -23,6 +23,7 @@
*/
package ui.progressBar;
import net.miginfocom.swing.MigLayout;
import ui.ComponentDemo;
import ui.DemoPanel;
@ -46,7 +47,7 @@ public class ProgressBarDemo implements ComponentDemo {
progressBar.setValue(50);
DemoPanel panel = new DemoPanel(progressBar);
JPanel controlPanel = panel.getControls();
controlPanel.setLayout(new GridLayout(5, 2));
controlPanel.setLayout(new MigLayout("fillx, wrap 2", "[][grow]"));
controlPanel.add(new JCheckBox("enabled") {{
setSelected(progressBar.isEnabled());
addActionListener(e -> progressBar.setEnabled(isSelected()));

3
core/src/test/java/ui/radioButton/RadioButtonDemo.java

@ -23,6 +23,7 @@
*/
package ui.radioButton;
import net.miginfocom.swing.MigLayout;
import ui.ComponentDemo;
import ui.DemoPanel;
@ -40,7 +41,7 @@ public class RadioButtonDemo implements ComponentDemo {
JRadioButton button = new JRadioButton("Test RadioButton");
DemoPanel panel = new DemoPanel(button);
JPanel controlPanel = panel.getControls();
controlPanel.setLayout(new GridLayout(3, 2));
controlPanel.setLayout(new MigLayout("fillx, wrap 1", "[][grow]"));
controlPanel.add(new JCheckBox("enabled") {{
setSelected(button.isEnabled());
addActionListener(e -> button.setEnabled(isSelected()));

6
core/src/test/java/ui/scrollPane/ScrollPaneDemo.java

@ -23,6 +23,7 @@
*/
package ui.scrollPane;
import net.miginfocom.swing.MigLayout;
import ui.ComponentDemo;
import ui.DemoPanel;
import ui.DemoResources;
@ -58,13 +59,12 @@ public final class ScrollPaneDemo implements ComponentDemo {
JPanel controlPanel = panel.getControls();
controlPanel.setLayout(new GridLayout(3, 2));
controlPanel.setLayout(new MigLayout("fillx, wrap 2", "[][grow]"));
controlPanel.add(new JCheckBox("LeftToRight") {{
setSelected(scrollPane.getComponentOrientation().isLeftToRight());
addActionListener(e -> scrollPane.setComponentOrientation(isSelected() ? ComponentOrientation.LEFT_TO_RIGHT
: ComponentOrientation.RIGHT_TO_LEFT));
}});
controlPanel.add(new JLabel());
}}, "span");
controlPanel.add(new JCheckBox("UpperLeft corner") {{
addActionListener(e -> scrollPane.setCorner(JScrollPane.UPPER_LEFT_CORNER, isSelected() ? upperLeft : null));
}});

22
core/src/test/java/ui/slider/SliderDemo.java

@ -23,6 +23,7 @@
*/
package ui.slider;
import net.miginfocom.swing.MigLayout;
import ui.ComponentDemo;
import ui.DemoPanel;
@ -42,16 +43,8 @@ public class SliderDemo implements ComponentDemo {
slider.setMinorTickSpacing(5);
DemoPanel panel = new DemoPanel(slider);
JPanel controlPanel = panel.getControls();
controlPanel.setLayout(new GridLayout(6, 2));
controlPanel.add(new JCheckBox("enabled") {{
setSelected(slider.isEnabled());
addActionListener(e -> slider.setEnabled(isSelected()));
}});
controlPanel.add(new JCheckBox("LeftToRight") {{
setSelected(slider.getComponentOrientation().isLeftToRight());
addActionListener(e -> slider.setComponentOrientation(isSelected() ? ComponentOrientation.LEFT_TO_RIGHT
: ComponentOrientation.RIGHT_TO_LEFT));
}});
controlPanel.setLayout(new MigLayout("fillx, wrap 2", "[][grow]"));
controlPanel.add(new JLabel("Orientation:"));
controlPanel.add(new JComboBox<String>() {{
setEditable(false);
addItem("Horizontal");
@ -61,6 +54,15 @@ public class SliderDemo implements ComponentDemo {
slider.setOrientation(e.getItem() == "Vertical" ? JSlider.VERTICAL : JSlider.HORIZONTAL);
});
}});
controlPanel.add(new JCheckBox("enabled") {{
setSelected(slider.isEnabled());
addActionListener(e -> slider.setEnabled(isSelected()));
}});
controlPanel.add(new JCheckBox("LeftToRight") {{
setSelected(slider.getComponentOrientation().isLeftToRight());
addActionListener(e -> slider.setComponentOrientation(isSelected() ? ComponentOrientation.LEFT_TO_RIGHT
: ComponentOrientation.RIGHT_TO_LEFT));
}});
controlPanel.add(new JCheckBox("inverted") {{
setSelected(slider.getInverted());
addActionListener(e -> slider.setInverted(isSelected()));

4
core/src/test/java/ui/spinner/SpinnerDemo.java

@ -23,6 +23,7 @@
*/
package ui.spinner;
import net.miginfocom.swing.MigLayout;
import ui.ComponentDemo;
import ui.DemoPanel;
@ -40,7 +41,7 @@ public class SpinnerDemo implements ComponentDemo {
JSpinner spinner = new JSpinner();
DemoPanel panel = new DemoPanel(spinner);
JPanel controlPanel = panel.getControls();
controlPanel.setLayout(new GridLayout(3, 2));
controlPanel.setLayout(new MigLayout("fillx, wrap 1", "[][grow]"));
controlPanel.add(new JCheckBox("enabled") {{
setSelected(spinner.isEnabled());
addActionListener(e -> spinner.setEnabled(isSelected()));
@ -53,7 +54,6 @@ public class SpinnerDemo implements ComponentDemo {
controlPanel.add(new JCheckBox("JSpinner.variant = plusMinus") {{
addActionListener(e -> spinner.putClientProperty("JSpinner.variant", isSelected() ? "plusMinus" : null));
}});
controlPanel.add(new JLabel());
controlPanel.add(new JCheckBox("JSpinner.isTreeCellEditor") {{
setSelected(false);
addActionListener(e -> spinner.putClientProperty("JSpinner.isTreeCellEditor", isSelected()));

3
core/src/test/java/ui/splitPane/SplitPaneDemo.java

@ -23,6 +23,7 @@
*/
package ui.splitPane;
import net.miginfocom.swing.MigLayout;
import ui.ComponentDemo;
import ui.DemoPanel;
@ -51,7 +52,7 @@ public final class SplitPaneDemo implements ComponentDemo {
DemoPanel panel = new DemoPanel(splitPane, new BorderLayout());
JPanel controlPanel = panel.getControls();
controlPanel.setLayout(new GridLayout(3, 2));
controlPanel.setLayout(new MigLayout("fillx, wrap 2", "[][grow]"));
controlPanel.add(new JCheckBox("ContinuousLayout") {{
setSelected(splitPane.isContinuousLayout());
addActionListener(e -> splitPane.setContinuousLayout(isSelected()));

30
core/src/test/java/ui/tabbedPane/TabbedPaneDemo.java

@ -24,6 +24,7 @@
package ui.tabbedPane;
import com.github.weisj.darklaf.util.StringUtil;
import net.miginfocom.swing.MigLayout;
import ui.ComponentDemo;
import ui.DemoPanel;
@ -55,21 +56,7 @@ public class TabbedPaneDemo implements ComponentDemo {
DemoPanel panel = new DemoPanel(tabbedPane, new BorderLayout());
JPanel controlPanel = panel.getControls();
controlPanel.setLayout(new GridLayout(7, 2));
controlPanel.add(new JCheckBox("LeftToRight") {{
setSelected(tabbedPane.getComponentOrientation().isLeftToRight());
addActionListener(e -> tabbedPane.setComponentOrientation(isSelected() ? ComponentOrientation.LEFT_TO_RIGHT
: ComponentOrientation.RIGHT_TO_LEFT));
}});
controlPanel.add(new JCheckBox("JTabbedPane.dndEnabled") {{
setSelected(false);
addActionListener(e -> tabbedPane.putClientProperty("JTabbedPane.dndEnabled", isSelected()));
}});
controlPanel.add(new JCheckBox("JTabbedPane.showNewTabButton") {{
setSelected(false);
addActionListener(e -> tabbedPane.putClientProperty("JTabbedPane.showNewTabButton", isSelected()));
}});
controlPanel.add(new JLabel());
controlPanel.setLayout(new MigLayout("fillx, wrap 2", "[][grow]"));
controlPanel.add(new JLabel("TabLayoutPolicy:", JLabel.RIGHT));
controlPanel.add(new JComboBox<String>() {{
Map<String, Integer> mapping = new HashMap<String, Integer>() {{
@ -98,6 +85,19 @@ public class TabbedPaneDemo implements ComponentDemo {
//noinspection MagicConstant
addItemListener(e -> tabbedPane.setTabPlacement(mapping.get(e.getItem().toString())));
}});
controlPanel.add(new JCheckBox("LeftToRight") {{
setSelected(tabbedPane.getComponentOrientation().isLeftToRight());
addActionListener(e -> tabbedPane.setComponentOrientation(isSelected() ? ComponentOrientation.LEFT_TO_RIGHT
: ComponentOrientation.RIGHT_TO_LEFT));
}});
controlPanel.add(new JCheckBox("JTabbedPane.dndEnabled") {{
setSelected(false);
addActionListener(e -> tabbedPane.putClientProperty("JTabbedPane.dndEnabled", isSelected()));
}});
controlPanel.add(new JCheckBox("JTabbedPane.showNewTabButton") {{
setSelected(false);
addActionListener(e -> tabbedPane.putClientProperty("JTabbedPane.showNewTabButton", isSelected()));
}});
controlPanel.add(new JCheckBox("JTabbedPane.leadingComponent") {{
setSelected(false);
JLabel leading = new PlaceholderLabel("Leading");

3
core/src/test/java/ui/table/TableDemo.java

@ -24,6 +24,7 @@
package ui.table;
import com.github.weisj.darklaf.ui.table.DarkTableCellEditor;
import net.miginfocom.swing.MigLayout;
import ui.ComponentDemo;
import ui.DemoPanel;
@ -76,7 +77,7 @@ public class TableDemo implements ComponentDemo {
DemoPanel panel = new DemoPanel(new JScrollPane(table));
JPanel controlPanel = panel.getControls();
controlPanel.setLayout(new GridLayout(4, 2));
controlPanel.setLayout(new MigLayout("fillx, wrap 2", "[][grow]"));
controlPanel.add(new JCheckBox("enabled") {{
setSelected(table.isEnabled());
addActionListener(e -> table.setEnabled(isSelected()));

3
core/src/test/java/ui/text/PasswordFieldDemo.java

@ -23,6 +23,7 @@
*/
package ui.text;
import net.miginfocom.swing.MigLayout;
import ui.ComponentDemo;
import ui.DemoPanel;
@ -40,7 +41,7 @@ public class PasswordFieldDemo implements ComponentDemo {
JPasswordField textField = new JPasswordField("Demo PasswordField");
DemoPanel panel = new DemoPanel(textField);
JPanel controlPanel = panel.getControls();
controlPanel.setLayout(new GridLayout(3, 2));
controlPanel.setLayout(new MigLayout("fillx, wrap 2", "[][grow]"));
controlPanel.add(new JCheckBox("enabled") {{
setSelected(textField.isEnabled());
addActionListener(e -> textField.setEnabled(isSelected()));

4
core/src/test/java/ui/text/TextComponentDemo.java

@ -25,13 +25,13 @@ package ui.text;
import com.github.weisj.darklaf.ui.text.DarkTextBorder;
import com.github.weisj.darklaf.util.StringUtil;
import net.miginfocom.swing.MigLayout;
import ui.ComponentDemo;
import ui.DemoPanel;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.text.JTextComponent;
import java.awt.*;
public abstract class TextComponentDemo<T extends JTextComponent> implements ComponentDemo {
@ -44,7 +44,7 @@ public abstract class TextComponentDemo<T extends JTextComponent> implements Com
Border border = text.getBorder();
JPanel controlPanel = panel.getControls();
controlPanel.setLayout(new GridLayout(3, 2));
controlPanel.setLayout(new MigLayout("fillx, wrap 2", "[][grow]"));
controlPanel.add(new JCheckBox("enabled") {{
setSelected(text.isEnabled());
addActionListener(e -> text.setEnabled(isSelected()));

3
core/src/test/java/ui/text/TextFieldDemo.java

@ -23,6 +23,7 @@
*/
package ui.text;
import net.miginfocom.swing.MigLayout;
import ui.ComponentDemo;
import ui.DemoPanel;
@ -40,7 +41,7 @@ public class TextFieldDemo implements ComponentDemo {
JTextField textField = new JTextField("Demo TextField");
DemoPanel panel = new DemoPanel(textField);
JPanel controlPanel = panel.getControls();
controlPanel.setLayout(new GridLayout(3, 2));
controlPanel.setLayout(new MigLayout("fillx, wrap 2", "[][grow]"));
controlPanel.add(new JCheckBox("enabled") {{
setSelected(textField.isEnabled());
addActionListener(e -> textField.setEnabled(isSelected()));

6
core/src/test/java/ui/tree/TreeDemo.java

@ -25,6 +25,7 @@ package ui.tree;
import com.github.weisj.darklaf.components.OverlayScrollPane;
import com.github.weisj.darklaf.components.SelectableTreeNode;
import net.miginfocom.swing.MigLayout;
import ui.ComponentDemo;
import ui.DemoPanel;
@ -56,7 +57,7 @@ public class TreeDemo implements ComponentDemo {
JTree tree = new JTree(root);
DemoPanel panel = new DemoPanel(new OverlayScrollPane(tree), new BorderLayout());
JPanel controlPanel = panel.getControls();
controlPanel.setLayout(new GridLayout(5, 2));
controlPanel.setLayout(new MigLayout("fillx, wrap 2", "[][grow]"));
controlPanel.add(new JCheckBox("editable") {{
setSelected(tree.isEditable());
addActionListener(e -> tree.setEditable(isSelected()));
@ -77,8 +78,7 @@ public class TreeDemo implements ComponentDemo {
controlPanel.add(new JCheckBox("JTree.renderBooleanAsCheckBox") {{
setSelected(Boolean.TRUE.equals(tree.getClientProperty("JTree.renderBooleanAsCheckBox")));
addActionListener(e -> tree.putClientProperty("JTree.renderBooleanAsCheckBox", isSelected()));
}});
controlPanel.add(new JLabel());
}}, "span");
controlPanel.add(new JLabel("JTree.booleanRenderType:", JLabel.RIGHT));
controlPanel.add(new JComboBox<String>() {{
addItem("checkBox");

Loading…
Cancel
Save