Commit c34802ce authored by Benedikt Zoennchen's avatar Benedikt Zoennchen
Browse files

GUI-PostVis: make settings dialog scrollable

parent 4e0c4867
...@@ -46,23 +46,29 @@ public class SettingsDialog extends JDialog { ...@@ -46,23 +46,29 @@ public class SettingsDialog extends JDialog {
"5dlu, pref, 2dlu, pref, 2dlu, pref, 5dlu"); // rows "5dlu, pref, 2dlu, pref, 2dlu, pref, 5dlu"); // rows
CellConstraints cc = new CellConstraints(); CellConstraints cc = new CellConstraints();
getContentPane().setLayout(mainLayout); JPanel mainPanel = new JPanel();
mainPanel.setLayout(mainLayout);
JScrollPane scrollPane = new JScrollPane(mainPanel);
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
getContentPane().add(scrollPane);
JLayeredPane colorLayeredPane = new JLayeredPane(); JLayeredPane colorLayeredPane = new JLayeredPane();
JLayeredPane additionalLayeredPane = new JLayeredPane(); JLayeredPane additionalLayeredPane = new JLayeredPane();
colorLayeredPane colorLayeredPane
.setBorder(BorderFactory.createTitledBorder(Messages.getString("SettingsDialog.colors.border.text"))); .setBorder(BorderFactory.createTitledBorder(Messages.getString("SettingsDialog.colors.border.text")));
getContentPane().add(colorLayeredPane, cc.xy(2, 2)); mainPanel.add(colorLayeredPane, cc.xy(2, 2));
additionalLayeredPane.setBorder( additionalLayeredPane.setBorder(
BorderFactory.createTitledBorder(Messages.getString("SettingsDialog.additional.border.text"))); BorderFactory.createTitledBorder(Messages.getString("SettingsDialog.additional.border.text")));
getContentPane().add(additionalLayeredPane, cc.xy(2, 4)); mainPanel.add(additionalLayeredPane, cc.xy(2, 4));
JButton closeButton = new JButton(Messages.getString("SettingsDialog.btnClose.text")); JButton closeButton = new JButton(Messages.getString("SettingsDialog.btnClose.text"));
JPanel controlPanel = new JPanel(); JPanel controlPanel = new JPanel();
controlPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); controlPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
controlPanel.add(closeButton); controlPanel.add(closeButton);
closeButton.addActionListener(new ActionCloseSettingDialog(this)); closeButton.addActionListener(new ActionCloseSettingDialog(this));
getContentPane().add(controlPanel, cc.xyw(2, 6, 2)); mainPanel.add(controlPanel, cc.xyw(2, 6, 2));
// ###################################################################################### // ######################################################################################
// Layout definition for sub panels // Layout definition for sub panels
...@@ -277,8 +283,9 @@ public class SettingsDialog extends JDialog { ...@@ -277,8 +283,9 @@ public class SettingsDialog extends JDialog {
}); });
additionalLayeredPane.add(chChowLogo, cc.xyw(2, 24, 5)); additionalLayeredPane.add(chChowLogo, cc.xyw(2, 24, 5));
scrollPane.setPreferredSize(new Dimension(mainPanel.getPreferredSize().width+10, Math.min(mainPanel.getPreferredSize().height, Toolkit.getDefaultToolkit().getScreenSize().height - 50)));
pack(); pack();
setResizable(false); setResizable(true);
SwingUtils.centerComponent(this); SwingUtils.centerComponent(this);
setVisible(true); setVisible(true);
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment