From 754120d5f3f715b02600b1315c8926ba3e4504d7 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 17 Nov 2014 11:16:59 +0000 Subject: [PATCH] JAL-1580 size parameters dialog to height of Desktop --- src/jalview/gui/WsJobParameters.java | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/jalview/gui/WsJobParameters.java b/src/jalview/gui/WsJobParameters.java index 23645df..8c889c9 100644 --- a/src/jalview/gui/WsJobParameters.java +++ b/src/jalview/gui/WsJobParameters.java @@ -218,7 +218,9 @@ public class WsJobParameters extends JPanel implements ItemListener, frame = new JDialog(Desktop.instance, true); - frame.setTitle(MessageManager.formatMessage("label.edit_params_for", new String[]{service.getActionText()})); + frame.setTitle(MessageManager.formatMessage("label.edit_params_for", + new String[] + { service.getActionText() })); Rectangle deskr = Desktop.instance.getBounds(); Dimension pref = this.getPreferredSize(); frame.setBounds(new Rectangle( @@ -342,7 +344,6 @@ public class WsJobParameters extends JPanel implements ItemListener, setDescr.setToolTipText(MessageManager .getString("label.edit_notes_parameter_set")); JScrollPane setDescrView = new JScrollPane(); - // setDescrView.setPreferredSize(new Dimension(350, 200)); setDescrView.getViewport().setView(setDescr); setName.setEditable(true); setName.addItemListener(this); @@ -426,6 +427,8 @@ public class WsJobParameters extends JPanel implements ItemListener, JPanel dialogpanel = new JPanel(); dialogpanel.add(startjob); dialogpanel.add(canceljob); + // JAL-1580: setMaximumSize() doesn't work, so just size for the worst case: + setPreferredSize(new Dimension(540, Desktop.instance.getHeight())); add(dialogpanel, BorderLayout.SOUTH); validate(); } @@ -527,7 +530,7 @@ public class WsJobParameters extends JPanel implements ItemListener, Hashtable exnames = new Hashtable(); for (int i = 0, iSize = setName.getItemCount(); i < iSize; i++) { - exnames.put((String) setName.getItemAt(i), setName.getItemAt(i)); + exnames.put(setName.getItemAt(i), setName.getItemAt(i)); } servicePresets = new Hashtable(); // Add the default entry - if not present already. @@ -1091,7 +1094,9 @@ public class WsJobParameters extends JPanel implements ItemListener, } WsJobParameters pgui = new WsJobParameters(lastserv, new JabaPreset(lastserv, pr)); - JFrame jf = new JFrame(MessageManager.formatMessage("label.ws_parameters_for", new String[]{lastserv.getActionText()})); + JFrame jf = new JFrame(MessageManager.formatMessage( + "label.ws_parameters_for", new String[] + { lastserv.getActionText() })); JPanel cont = new JPanel(new BorderLayout()); pgui.validate(); cont.setPreferredSize(pgui.getPreferredSize()); @@ -1401,7 +1406,7 @@ public class WsJobParameters extends JPanel implements ItemListener, if (src.getParent() == setName) { // rename any existing records we know about for this set. - String newname = (String) e.getActionCommand().trim(); + String newname = e.getActionCommand().trim(); String msg = null; if (isServicePreset(newname)) { @@ -1415,9 +1420,10 @@ public class WsJobParameters extends JPanel implements ItemListener, { public void run() { - JOptionPane.showMessageDialog(ourframe, - MessageManager.getString("label.invalid_name_preset_exists"), - MessageManager.getString("label.invalid_name"), JOptionPane.WARNING_MESSAGE); + JOptionPane.showMessageDialog(ourframe, MessageManager + .getString("label.invalid_name_preset_exists"), + MessageManager.getString("label.invalid_name"), + JOptionPane.WARNING_MESSAGE); } }); -- 1.7.10.2