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

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

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

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

@ -24,6 +24,7 @@
package ui.table;
import com.github.weisj.darklaf.ui.table.DarkTableCellEditor;
import com.github.weisj.darklaf.ui.table.DarkTableUI;
import com.github.weisj.darklaf.util.PropertyKey;
import ui.ComponentDemo;
import ui.DemoPanel;
@ -96,6 +97,10 @@ public class TableDemo implements ComponentDemo {
addActionListener(e -> table.setComponentOrientation(isSelected() ? ComponentOrientation.LEFT_TO_RIGHT
: 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") {{
setSelected(header.getReorderingAllowed());
addActionListener(e -> header.setReorderingAllowed(isSelected()));
@ -114,6 +119,18 @@ public class TableDemo implements ComponentDemo {
addActionListener(e -> table.setRowSelectionAllowed(isSelected()));
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.add(new JLabel("Row height:"));
controlPanel.add(new JSpinner() {{

Loading…
Cancel
Save