Browse Source

Make less functions static in ComponentDemo.

pull/188/head
weisj 5 years ago
parent
commit
5fd3794c8b
  1. 14
      core/src/test/java/ui/ComponentDemo.java
  2. 2
      core/src/test/java/ui/button/HelpButtonDemo.java
  3. 2
      core/src/test/java/ui/checkBox/CheckBoxDemo.java
  4. 2
      core/src/test/java/ui/checkBox/TriCheckBoxDemo.java
  5. 3
      core/src/test/java/ui/internalFrame/InternalFrameDemo.java
  6. 2
      core/src/test/java/ui/popupMenu/PopupMenuDemo.java
  7. 2
      core/src/test/java/ui/radioButton/RadioButtonDemo.java

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

@ -52,6 +52,10 @@ public interface ComponentDemo {
themeStyle.getColorToneRule())); themeStyle.getColorToneRule()));
} }
default Theme createTheme() {
return getTheme();
}
JComponent createComponent(); JComponent createComponent();
static void showDemo(final ComponentDemo demo) { static void showDemo(final ComponentDemo demo) {
@ -169,10 +173,6 @@ public interface ComponentDemo {
} }
default JMenuBar createMenuBar() { default JMenuBar createMenuBar() {
return getDefaultMenuBar();
}
static JMenuBar getDefaultMenuBar() {
JMenuBar menuBar = new JMenuBar(); JMenuBar menuBar = new JMenuBar();
menuBar.add(createThemeMenu()); menuBar.add(createThemeMenu());
menuBar.add(createSettingsMenu()); menuBar.add(createSettingsMenu());
@ -180,7 +180,7 @@ public interface ComponentDemo {
return menuBar; return menuBar;
} }
static JMenu createDevSettings() { default JMenu createDevSettings() {
JMenu dev = new JMenu("Dev"); JMenu dev = new JMenu("Dev");
JMenu logging = new JMenu("Logging"); JMenu logging = new JMenu("Logging");
ButtonGroup bg = new ButtonGroup(); ButtonGroup bg = new ButtonGroup();
@ -207,10 +207,6 @@ public interface ComponentDemo {
return dev; return dev;
} }
default Theme createTheme() {
return getTheme();
}
String getTitle(); String getTitle();
class ThemeMenuItem extends JRadioButtonMenuItem { class ThemeMenuItem extends JRadioButtonMenuItem {

2
core/src/test/java/ui/button/HelpButtonDemo.java

@ -67,7 +67,7 @@ public class HelpButtonDemo implements ComponentDemo {
@Override @Override
public JMenuBar createMenuBar() { public JMenuBar createMenuBar() {
JMenuBar menuBar = ComponentDemo.getDefaultMenuBar(); JMenuBar menuBar = ComponentDemo.super.createMenuBar();
menuBar.add(new JMenu("Help") { menuBar.add(new JMenu("Help") {
{ {
add(new HelpMenuItem("View Help")); add(new HelpMenuItem("View Help"));

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

@ -86,7 +86,7 @@ public class CheckBoxDemo implements ComponentDemo {
@Override @Override
public JMenuBar createMenuBar() { public JMenuBar createMenuBar() {
JMenuBar menuBar = ComponentDemo.getDefaultMenuBar(); JMenuBar menuBar = ComponentDemo.super.createMenuBar();
menuBar.add(new JMenu("Demo") { menuBar.add(new JMenu("Demo") {
{ {
add(new JCheckBoxMenuItem("CheckBox menu item")); add(new JCheckBoxMenuItem("CheckBox menu item"));

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

@ -88,7 +88,7 @@ public class TriCheckBoxDemo implements ComponentDemo {
@Override @Override
public JMenuBar createMenuBar() { public JMenuBar createMenuBar() {
JMenuBar menuBar = ComponentDemo.getDefaultMenuBar(); JMenuBar menuBar = ComponentDemo.super.createMenuBar();
menuBar.add(new JMenu("Demo") { menuBar.add(new JMenu("Demo") {
{ {
add(new TristateCheckBoxMenuItem("TristateCheckBox menu item")); add(new TristateCheckBoxMenuItem("TristateCheckBox menu item"));

3
core/src/test/java/ui/internalFrame/InternalFrameDemo.java

@ -64,14 +64,13 @@ public class InternalFrameDemo implements ActionListener, ComponentDemo {
createFrame(); createFrame();
// Make dragging a little faster but perhaps uglier.
desktop.setDragMode(JDesktopPane.LIVE_DRAG_MODE); desktop.setDragMode(JDesktopPane.LIVE_DRAG_MODE);
return new DemoPanel(desktop, new BorderLayout(), 10); return new DemoPanel(desktop, new BorderLayout(), 10);
} }
@Override @Override
public JMenuBar createMenuBar() { public JMenuBar createMenuBar() {
JMenuBar menuBar = ComponentDemo.getDefaultMenuBar(); JMenuBar menuBar = ComponentDemo.super.createMenuBar();
// Set up the lone menu. // Set up the lone menu.
JMenu menu = new JMenu("Document"); JMenu menu = new JMenu("Document");

2
core/src/test/java/ui/popupMenu/PopupMenuDemo.java

@ -130,7 +130,7 @@ public class PopupMenuDemo implements ComponentDemo {
@Override @Override
public JMenuBar createMenuBar() { public JMenuBar createMenuBar() {
JMenuBar menuBar = ComponentDemo.getDefaultMenuBar(); JMenuBar menuBar = ComponentDemo.super.createMenuBar();
menuBar.add(new JMenu("CheckBoxes") { menuBar.add(new JMenu("CheckBoxes") {
{ {
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {

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

@ -86,7 +86,7 @@ public class RadioButtonDemo implements ComponentDemo {
@Override @Override
public JMenuBar createMenuBar() { public JMenuBar createMenuBar() {
JMenuBar menuBar = ComponentDemo.getDefaultMenuBar(); JMenuBar menuBar = ComponentDemo.super.createMenuBar();
menuBar.add(new JMenu("Demo") { menuBar.add(new JMenu("Demo") {
{ {
add(new JRadioButtonMenuItem("RadioButton menu item")); add(new JRadioButtonMenuItem("RadioButton menu item"));

Loading…
Cancel
Save