From b0c109811045e327516128f8408641d8e05127ec Mon Sep 17 00:00:00 2001 From: Nathan Cannon Date: Sun, 13 Mar 2016 22:46:57 +0000 Subject: [PATCH] Changed layout to have buttons fill width. --- src/main/java/musicplayer/LibraryConfigGUI.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/musicplayer/LibraryConfigGUI.java b/src/main/java/musicplayer/LibraryConfigGUI.java index b285d43..49e4a18 100644 --- a/src/main/java/musicplayer/LibraryConfigGUI.java +++ b/src/main/java/musicplayer/LibraryConfigGUI.java @@ -28,16 +28,20 @@ class LibraryConfigGUI { listLibraryFolders.setModel(listModel); mainPanel.add(listLibraryFolders, BorderLayout.CENTER); final JPanel panel2 = new JPanel(); - panel2.setLayout(new BoxLayout(panel2, BoxLayout.PAGE_AXIS)); + panel2.setLayout(new GridBagLayout()); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weightx = 1; + constraints.gridx = 0; mainPanel.add(panel2, BorderLayout.EAST); JButton addNewButton = new JButton(); addNewButton.setText("Add New"); addNewButton.addActionListener(e -> addNew()); - panel2.add(addNewButton); + panel2.add(addNewButton, constraints); JButton removeButton = new JButton(); removeButton.setText("Remove"); removeButton.addActionListener(e -> removeSelected()); - panel2.add(removeButton); + panel2.add(removeButton, constraints); return mainPanel; }