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