From: Niki Roo Date: Fri, 31 May 2019 12:49:03 +0000 (+0200) Subject: ConfigEditor: always show buttons X-Git-Tag: nikiroo-utils-5.1.0~12 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=a721319a248d9452a91ed35ae708864cd33d1e6e;p=nikiroo-utils.git ConfigEditor: always show buttons --- diff --git a/src/be/nikiroo/utils/ui/ConfigEditor.java b/src/be/nikiroo/utils/ui/ConfigEditor.java index 2bc9dc9..27e517b 100644 --- a/src/be/nikiroo/utils/ui/ConfigEditor.java +++ b/src/be/nikiroo/utils/ui/ConfigEditor.java @@ -50,12 +50,8 @@ public class ConfigEditor> extends JPanel { */ public ConfigEditor(Class type, final Bundle bundle, String title) { this.setLayout(new BorderLayout()); - JPanel main = new JPanel(); - - JScrollPane scroll = new JScrollPane(main); - scroll.getVerticalScrollBar().setUnitIncrement(16); - this.add(scroll, BorderLayout.CENTER); + JPanel main = new JPanel(); main.setLayout(new BoxLayout(main, BoxLayout.PAGE_AXIS)); main.setBorder(new EmptyBorder(5, 5, 5, 5)); @@ -68,7 +64,11 @@ public class ConfigEditor> extends JPanel { addItem(main, item, 0); } - main.add(createButton("Reset", new ActionListener() { + JPanel buttons = new JPanel(); + buttons.setLayout(new BoxLayout(buttons, BoxLayout.PAGE_AXIS)); + buttons.setBorder(new EmptyBorder(5, 5, 5, 5)); + + buttons.add(createButton("Reset", new ActionListener() { @Override public void actionPerformed(ActionEvent e) { for (MetaInfo item : items) { @@ -77,7 +77,7 @@ public class ConfigEditor> extends JPanel { } })); - main.add(createButton("Default", new ActionListener() { + buttons.add(createButton("Default", new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Object snap = bundle.takeSnapshot(); @@ -90,7 +90,7 @@ public class ConfigEditor> extends JPanel { } })); - main.add(createButton("Save", new ActionListener() { + buttons.add(createButton("Save", new ActionListener() { @Override public void actionPerformed(ActionEvent e) { for (MetaInfo item : items) { @@ -104,6 +104,12 @@ public class ConfigEditor> extends JPanel { } } })); + + JScrollPane scroll = new JScrollPane(main); + scroll.getVerticalScrollBar().setUnitIncrement(16); + + this.add(scroll, BorderLayout.CENTER); + this.add(buttons, BorderLayout.SOUTH); } private void addItem(JPanel main, MetaInfo item, int nhgap) {