aboutsummaryrefslogtreecommitdiffstats
path: root/netx/net/sourceforge/jnlp/controlpanel
diff options
context:
space:
mode:
authorAndrew Su <[email protected]>2011-06-14 13:30:55 -0400
committerAndrew Su <[email protected]>2011-06-14 13:30:55 -0400
commit9c4b0a7764e967c9273fae59b632ca06145d5219 (patch)
treecbb29c8ac3e2efa67e8085a9a2b0e61d74f4c144 /netx/net/sourceforge/jnlp/controlpanel
parent8b857cf2af30091f851656b269a622f0152905fb (diff)
Make itweb-settings resizable
Diffstat (limited to 'netx/net/sourceforge/jnlp/controlpanel')
-rw-r--r--netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java17
-rw-r--r--netx/net/sourceforge/jnlp/controlpanel/NetworkSettingsPanel.java43
2 files changed, 43 insertions, 17 deletions
diff --git a/netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java b/netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java
index 7400b3f..a023c79 100644
--- a/netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java
+++ b/netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java
@@ -115,7 +115,6 @@ public class ControlPanel extends JFrame {
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
pack();
setMinimumSize(getPreferredSize());
- setResizable(false);
}
private JPanel createTopPanel() {
@@ -232,9 +231,23 @@ public class ControlPanel extends JFrame {
// Add panels.
final JPanel settingsPanel = new JPanel(new CardLayout());
+
+ // Calculate largest minimum size we should use.
+ int height = 0;
+ int width = 0;
+ for (SettingsPanel panel : panels) {
+ JPanel p = panel.getPanel();
+ Dimension d = p.getMinimumSize();
+ if (d.height > height)
+ height = d.height;
+ if (d.width > width)
+ width = d.width;
+ }
+ Dimension dim = new Dimension(width, height);
+
for (SettingsPanel panel : panels) {
JPanel p = panel.getPanel();
- p.setPreferredSize(new Dimension(530, 360));
+ p.setPreferredSize(dim);
settingsPanel.add(p, panel.toString());
}
diff --git a/netx/net/sourceforge/jnlp/controlpanel/NetworkSettingsPanel.java b/netx/net/sourceforge/jnlp/controlpanel/NetworkSettingsPanel.java
index a599c16..cb7b99a 100644
--- a/netx/net/sourceforge/jnlp/controlpanel/NetworkSettingsPanel.java
+++ b/netx/net/sourceforge/jnlp/controlpanel/NetworkSettingsPanel.java
@@ -25,6 +25,7 @@ import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
+import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
@@ -108,8 +109,8 @@ public class NetworkSettingsPanel extends JPanel implements ActionListener {
this.description.add(description[i], String.valueOf(i - 1));
// Settings for selecting Proxy Server
- JPanel proxyServerPanel = new JPanel(new BorderLayout());
- JPanel proxyLocationPanel = new JPanel(new FlowLayout(FlowLayout.LEADING));
+ JPanel proxyServerPanel = new JPanel(new GridLayout(0, 1));
+ JPanel proxyLocationPanel = new JPanel(new GridBagLayout());
JPanel proxyBypassPanel = new JPanel(new FlowLayout(FlowLayout.LEADING));
JLabel addressLabel = new JLabel(Translator.R("NSAddress") + ":");
@@ -140,17 +141,24 @@ public class NetworkSettingsPanel extends JPanel implements ActionListener {
config.setProperty(properties[3], String.valueOf(e.getStateChange() == ItemEvent.SELECTED));
}
});
- proxyLocationPanel.add(Box.createRigidArea(new Dimension(13, 0)));
- proxyLocationPanel.add(addressLabel);
- proxyLocationPanel.add(addressField);
- proxyLocationPanel.add(portLabel);
- proxyLocationPanel.add(portField);
- proxyLocationPanel.add(advancedProxyButton);
- proxyBypassPanel.add(Box.createRigidArea(new Dimension(10, 0)));
+ c.gridy = 0;
+ c.gridx = GridBagConstraints.RELATIVE;
+ c.weightx = 0;
+ proxyLocationPanel.add(Box.createHorizontalStrut(20), c);
+ proxyLocationPanel.add(addressLabel, c);
+ c.weightx = 1;
+ proxyLocationPanel.add(addressField, c);
+ c.weightx = 0;
+ proxyLocationPanel.add(portLabel, c);
+ c.weightx = 1;
+ proxyLocationPanel.add(portField, c);
+ c.weightx = 0;
+ proxyLocationPanel.add(advancedProxyButton, c);
+ proxyBypassPanel.add(Box.createHorizontalStrut(5));
proxyBypassPanel.add(bypassCheckBox);
- proxyServerPanel.add(proxyLocationPanel, BorderLayout.CENTER);
- proxyServerPanel.add(proxyBypassPanel, BorderLayout.SOUTH);
+ proxyServerPanel.add(proxyLocationPanel);
+ proxyServerPanel.add(proxyBypassPanel);
JRadioButton directConnection = new JRadioButton(Translator.R("NSDirectConnection"), config.getProperty(properties[0]).equals("0"));
directConnection.setActionCommand("0");
@@ -175,15 +183,20 @@ public class NetworkSettingsPanel extends JPanel implements ActionListener {
modeSelect.add(directConnection);
// Settings for Automatic Proxy Configuration Script
- JPanel proxyAutoPanel = new JPanel(new FlowLayout(FlowLayout.LEADING));
+ JPanel proxyAutoPanel = new JPanel(new GridBagLayout());
JLabel locationLabel = new JLabel(Translator.R("NSScriptLocation") + ":");
final JTextField locationField = new JTextField(config.getProperty(properties[4]), 20);
locationField.getDocument().addDocumentListener(new DocumentAdapter(config, properties[4]));
- proxyAutoPanel.add(Box.createRigidArea(new Dimension(13, 0)));
- proxyAutoPanel.add(locationLabel);
- proxyAutoPanel.add(locationField);
+ c.gridx = 0;
+ proxyAutoPanel.add(Box.createHorizontalStrut(20), c);
+ c.gridx = GridBagConstraints.RELATIVE;
+ proxyAutoPanel.add(locationLabel, c);
+ c.weightx = 1;
+ proxyAutoPanel.add(locationField, c);
+ c.weighty = 0;
+ c.gridx = 0;
c.gridy = 0;
settingPanel.add(networkDesc, c);
c.gridy = 1;