Browse Source

Replaced explicit Box construction with provided helper method.

pull/127/head
weisj 5 years ago
parent
commit
826d090b26
  1. 2
      core/src/main/java/com/github/weisj/darklaf/ui/filechooser/DarkFileChooserUI.java
  2. 7
      core/src/test/java/ui/button/GroupedButtonDemo.java

2
core/src/main/java/com/github/weisj/darklaf/ui/filechooser/DarkFileChooserUI.java

@ -229,7 +229,7 @@ public class DarkFileChooserUI extends DarkFileChooserUIBridge {
} }
protected Component createTopButtonArea() { protected Component createTopButtonArea() {
Box box = new Box(BoxLayout.LINE_AXIS); Box box = Box.createHorizontalBox();
box.add(createUpFolderButton()); box.add(createUpFolderButton());
box.add(makeHorizontalSpacer()); box.add(makeHorizontalSpacer());

7
core/src/test/java/ui/button/GroupedButtonDemo.java

@ -39,7 +39,7 @@ public class GroupedButtonDemo implements ComponentDemo {
@Override @Override
public JComponent createComponent() { public JComponent createComponent() {
Box box = new Box(BoxLayout.LINE_AXIS); Box box = Box.createHorizontalBox();
Icon icon = IconLoader.get().getIcon("menu/listFiles.svg", 19, 19, true); Icon icon = IconLoader.get().getIcon("menu/listFiles.svg", 19, 19, true);
Icon iconSelected = IconLoader.get().getIcon("menu/listFilesSelected.svg", 19, 19, true); Icon iconSelected = IconLoader.get().getIcon("menu/listFilesSelected.svg", 19, 19, true);
ButtonGroup bg = new ButtonGroup(); ButtonGroup bg = new ButtonGroup();
@ -49,7 +49,8 @@ public class GroupedButtonDemo implements ComponentDemo {
b = createButton(icon, iconSelected, bg, AlignmentExt.MIDDLE_HORIZONTAL, b); b = createButton(icon, iconSelected, bg, AlignmentExt.MIDDLE_HORIZONTAL, b);
box.add(b); box.add(b);
} }
box.add(createButton(icon, iconSelected, bg, AlignmentExt.RIGHT, b), true); box.add(createButton(icon, iconSelected, bg, AlignmentExt.RIGHT, true, b));
return new DemoPanel(box); return new DemoPanel(box);
} }
@ -69,7 +70,7 @@ public class GroupedButtonDemo implements ComponentDemo {
if (prev != null) prev.putClientProperty(DarkButtonUI.KEY_RIGHT_NEIGHBOUR, this); if (prev != null) prev.putClientProperty(DarkButtonUI.KEY_RIGHT_NEIGHBOUR, this);
putClientProperty(DarkButtonUI.KEY_LEFT_NEIGHBOUR, prev); putClientProperty(DarkButtonUI.KEY_LEFT_NEIGHBOUR, prev);
setSelected(isSelected); setSelected(isSelected);
// bg.add(this); bg.add(this);
}}; }};
} }

Loading…
Cancel
Save