Browse Source

Added missing controls for some tests.

pull/127/head
weisj 5 years ago
parent
commit
a9be638177
  1. 1
      core/src/test/java/ui/ComponentDemo.java
  2. 15
      core/src/test/java/ui/button/ToggleButtonDemo.java
  3. 1
      core/src/test/java/ui/tabFrame/TabFrameDemo.java
  4. 17
      core/src/test/java/ui/table/TableDemo.java

1
core/src/test/java/ui/ComponentDemo.java

@ -65,6 +65,7 @@ public interface ComponentDemo {
new IntelliJTheme(), new IntelliJTheme(),
new SolarizedLightTheme(), new SolarizedLightTheme(),
new SolarizedDarkTheme(), new SolarizedDarkTheme(),
new HighContrastLightTheme(),
new HighContrastDarkTheme()}) { new HighContrastDarkTheme()}) {
createThemeItem(currentThemeName, menu, bg, theme); createThemeItem(currentThemeName, menu, bg, theme);
} }

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

@ -25,6 +25,7 @@ package ui.button;
import com.github.weisj.darklaf.icons.IconLoader; import com.github.weisj.darklaf.icons.IconLoader;
import com.github.weisj.darklaf.ui.togglebutton.DarkToggleButtonUI; import com.github.weisj.darklaf.ui.togglebutton.DarkToggleButtonUI;
import com.github.weisj.darklaf.ui.togglebutton.ToggleButtonConstants;
import ui.ComponentDemo; import ui.ComponentDemo;
import ui.DemoPanel; import ui.DemoPanel;
@ -67,18 +68,12 @@ public class ToggleButtonDemo implements ComponentDemo {
}}, "span"); }}, "span");
controlPanel = panel.addControls(); controlPanel = panel.addControls();
controlPanel.add(new JLabel("JToggleButton.variant:")); controlPanel.add(new JLabel(ToggleButtonConstants.KEY_VARIANT + ":"));
controlPanel.add(new JComboBox<String>() {{ controlPanel.add(new JComboBox<String>() {{
addItem("slider"); addItem(ToggleButtonConstants.VARIANT_SLIDER);
addItem("none"); addItem("none");
setSelectedItem("no JToggleButton.variant"); setSelectedItem("none");
addItemListener(e -> { addItemListener(e -> button.putClientProperty("JToggleButton.variant", e.getItem()));
if (e.getItem().equals("slider")) {
button.putClientProperty("JToggleButton.variant", "slider");
} else {
button.putClientProperty("JToggleButton.variant", null);
}
});
}}); }});
return panel; return panel;
} }

1
core/src/test/java/ui/tabFrame/TabFrameDemo.java

@ -93,6 +93,7 @@ public class TabFrameDemo implements ComponentDemo {
}}, Alignment.NORTH, 1); }}, Alignment.NORTH, 1);
*/ */
tabFrame.setAcceleratorAt(1, Alignment.NORTH_WEST, 0); tabFrame.setAcceleratorAt(1, Alignment.NORTH_WEST, 0);
tabFrame.setTabEnabled(Alignment.NORTH_EAST, 0, false);
JPanel contentPane = new JPanel(new BorderLayout()); JPanel contentPane = new JPanel(new BorderLayout());
contentPane.add(tabFrame, BorderLayout.CENTER); contentPane.add(tabFrame, BorderLayout.CENTER);

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

@ -24,6 +24,7 @@
package ui.table; package ui.table;
import com.github.weisj.darklaf.ui.table.DarkTableCellEditor; import com.github.weisj.darklaf.ui.table.DarkTableCellEditor;
import com.github.weisj.darklaf.ui.table.DarkTableUI;
import com.github.weisj.darklaf.util.PropertyKey; import com.github.weisj.darklaf.util.PropertyKey;
import ui.ComponentDemo; import ui.ComponentDemo;
import ui.DemoPanel; import ui.DemoPanel;
@ -96,6 +97,10 @@ public class TableDemo implements ComponentDemo {
addActionListener(e -> table.setComponentOrientation(isSelected() ? ComponentOrientation.LEFT_TO_RIGHT addActionListener(e -> table.setComponentOrientation(isSelected() ? ComponentOrientation.LEFT_TO_RIGHT
: ComponentOrientation.RIGHT_TO_LEFT)); : ComponentOrientation.RIGHT_TO_LEFT));
}}); }});
controlPanel.add(new JCheckBox(DarkTableUI.KEY_ALTERNATE_ROW_COLOR) {{
setSelected(Boolean.TRUE.equals(table.getClientProperty(DarkTableUI.KEY_ALTERNATE_ROW_COLOR)));
addActionListener(e -> table.putClientProperty(DarkTableUI.KEY_ALTERNATE_ROW_COLOR, isSelected()));
}});
controlPanel.add(new JCheckBox("reordering") {{ controlPanel.add(new JCheckBox("reordering") {{
setSelected(header.getReorderingAllowed()); setSelected(header.getReorderingAllowed());
addActionListener(e -> header.setReorderingAllowed(isSelected())); addActionListener(e -> header.setReorderingAllowed(isSelected()));
@ -114,6 +119,18 @@ public class TableDemo implements ComponentDemo {
addActionListener(e -> table.setRowSelectionAllowed(isSelected())); addActionListener(e -> table.setRowSelectionAllowed(isSelected()));
table.addPropertyChangeListener(e -> setSelected(table.getRowSelectionAllowed())); table.addPropertyChangeListener(e -> setSelected(table.getRowSelectionAllowed()));
}}); }});
controlPanel.add(new JCheckBox(DarkTableUI.KEY_RENDER_BOOLEAN_AS_CHECKBOX) {{
setSelected(Boolean.TRUE.equals(table.getClientProperty(DarkTableUI.KEY_RENDER_BOOLEAN_AS_CHECKBOX)));
addActionListener(e -> table.putClientProperty(DarkTableUI.KEY_RENDER_BOOLEAN_AS_CHECKBOX, isSelected()));
}}, "span");
controlPanel.add(new JLabel(DarkTableUI.KEY_BOOLEAN_RENDER_TYPE + ":", JLabel.RIGHT));
controlPanel.add(new JComboBox<String>() {{
addItem(DarkTableUI.RENDER_TYPE_CHECKBOX);
addItem(DarkTableUI.RENDER_TYPE_RADIOBUTTON);
setSelectedItem(table.getClientProperty(DarkTableUI.KEY_BOOLEAN_RENDER_TYPE));
addItemListener(e -> table.putClientProperty(DarkTableUI.KEY_BOOLEAN_RENDER_TYPE, e.getItem()));
}});
controlPanel = panel.addControls(3); controlPanel = panel.addControls(3);
controlPanel.add(new JLabel("Row height:")); controlPanel.add(new JLabel("Row height:"));
controlPanel.add(new JSpinner() {{ controlPanel.add(new JSpinner() {{

Loading…
Cancel
Save