Fixed layout of SettingsPanel in SettingsScreen
This commit is contained in:
parent
5570d845ae
commit
e6accec291
@ -60,7 +60,7 @@ public class SettingsScreen extends JDialog {
|
||||
setBounds(10, 10, 450, 650);
|
||||
getContentPane().setLayout(new BorderLayout());
|
||||
{
|
||||
// Content pane
|
||||
// ContentPane
|
||||
GridBagLayout gbl_contentPanel = new GridBagLayout();
|
||||
|
||||
gbl_contentPanel.columnWidths = new int[] { 1, 1 };
|
||||
@ -71,6 +71,14 @@ public class SettingsScreen extends JDialog {
|
||||
getContentPane().add(contentPanel, BorderLayout.CENTER);
|
||||
contentPanel.setLayout(gbl_contentPanel);
|
||||
|
||||
// Constraints for the settings panel
|
||||
GridBagConstraints gbc_panel = new GridBagConstraints();
|
||||
gbc_panel.fill = GridBagConstraints.BOTH;
|
||||
gbc_panel.gridx = 1;
|
||||
gbc_panel.gridy = 0;
|
||||
gbc_panel.anchor = GridBagConstraints.PAGE_START;
|
||||
gbc_panel.insets = insets;
|
||||
|
||||
options.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
options.addListSelectionListener((listSelectionEvent) -> {
|
||||
if (!listSelectionEvent.getValueIsAdjusting()) {
|
||||
@ -86,7 +94,7 @@ public class SettingsScreen extends JDialog {
|
||||
settingsPanel = panels.get(option).getDeclaredConstructor().newInstance();
|
||||
|
||||
// Add selected settings panel
|
||||
contentPanel.add(settingsPanel);
|
||||
contentPanel.add(settingsPanel, gbc_panel);
|
||||
revalidate();
|
||||
repaint();
|
||||
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
|
||||
|
@ -34,7 +34,7 @@ public class ThemeCustomizationPanel extends SettingsPanel {
|
||||
private JComboBox<String> themes = new JComboBox<>(themeArray);
|
||||
private Theme temporaryTheme, selectedTheme;
|
||||
|
||||
private final int space = 5;
|
||||
private final Insets insets = new Insets(5, 5, 5, 5);
|
||||
|
||||
private static final Logger logger = EnvoyLog.getLogger(ThemeCustomizationPanel.class.getSimpleName());
|
||||
|
||||
@ -46,14 +46,6 @@ public class ThemeCustomizationPanel extends SettingsPanel {
|
||||
public ThemeCustomizationPanel() {
|
||||
temporaryTheme = new Theme("temporaryTheme", Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()));
|
||||
|
||||
// Theme content
|
||||
GridBagConstraints gbc_themeContent = new GridBagConstraints();
|
||||
gbc_themeContent.fill = GridBagConstraints.BOTH;
|
||||
gbc_themeContent.gridx = 1;
|
||||
gbc_themeContent.gridy = 0;
|
||||
gbc_themeContent.anchor = GridBagConstraints.PAGE_START;
|
||||
gbc_themeContent.insets = new Insets(space, space, space, space);
|
||||
|
||||
GridBagLayout gbl_themeLayout = new GridBagLayout();
|
||||
|
||||
gbl_themeLayout.columnWidths = new int[] { 1, 1 };
|
||||
@ -80,7 +72,7 @@ public class ThemeCustomizationPanel extends SettingsPanel {
|
||||
gbc_themes.gridx = 0;
|
||||
gbc_themes.gridy = 0;
|
||||
gbc_themes.anchor = GridBagConstraints.NORTHWEST;
|
||||
gbc_themes.insets = new Insets(space, space, space, space);
|
||||
gbc_themes.insets = insets;
|
||||
|
||||
add(themes, gbc_themes);
|
||||
|
||||
@ -96,7 +88,7 @@ public class ThemeCustomizationPanel extends SettingsPanel {
|
||||
gbc_colorsPanel.gridy = 1;
|
||||
gbc_colorsPanel.gridwidth = 2;
|
||||
gbc_colorsPanel.anchor = GridBagConstraints.NORTHWEST;
|
||||
gbc_colorsPanel.insets = new Insets(space, 0, 0, 0);
|
||||
gbc_colorsPanel.insets = insets;
|
||||
|
||||
add(colorsPanel, gbc_colorsPanel);
|
||||
|
||||
|
Reference in New Issue
Block a user