From e0eedaf4fedaaa46439f40226637376c8eb268be Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Fri, 24 May 2019 12:32:43 +0100 Subject: [PATCH] JAL-3141 Fixed vertical size of the example filenames box\! Yay\! --- src/jalview/jbgui/GPreferences.java | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/jalview/jbgui/GPreferences.java b/src/jalview/jbgui/GPreferences.java index c132e49..5685e84 100755 --- a/src/jalview/jbgui/GPreferences.java +++ b/src/jalview/jbgui/GPreferences.java @@ -1824,7 +1824,6 @@ public class GPreferences extends JPanel gbc.gridy++; // row 1 backupsTab.add(presetsPanel, gbc); - // gbc.anchor = GridBagConstraints.NORTHWEST; // now using whole row gbc.gridwidth = 2; gbc.gridheight = 1; @@ -1850,10 +1849,6 @@ public class GPreferences extends JPanel { String title = MessageManager.getString("label.schemes"); - // TitledBorder tb = new TitledBorder(new EmptyBorder(0, 0, 0, 0), title); - // TitledBorder tb = new TitledBorder(title); - // tb.setTitleFont(LABEL_FONT); - // presetsPanel.setBorder(tb); presetsPanel.setLayout(new GridBagLayout()); @@ -2282,13 +2277,6 @@ public class GPreferences extends JPanel kgbc.gridwidth = GridBagConstraints.REMAINDER; kgbc.fill = GridBagConstraints.HORIZONTAL; kgbc.weightx = 1.0; - /* - keepfilesPanel.add(backupfilesConfirmDelete.getTrueButton(), kgbc); - - // fourth row (indented) - kgbc.gridy = 3; - keepfilesPanel.add(backupfilesConfirmDelete.getFalseButton(), kgbc); - */ JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); @@ -2344,6 +2332,7 @@ public class GPreferences extends JPanel int uppersurround = 0; StringBuilder exampleSB = new StringBuilder(); boolean firstLine = true; + int lineNumber = 0; if (reverse) { @@ -2354,6 +2343,7 @@ public class GPreferences extends JPanel if (index == min + lowersurround && index < max - uppersurround - 1) { exampleSB.append("\n..."); + lineNumber++; } else if (index > min + lowersurround && index < max - uppersurround) { @@ -2368,6 +2358,7 @@ public class GPreferences extends JPanel else { exampleSB.append("\n"); + lineNumber++; } exampleSB.append(BackupFilenameParts.getBackupFilename(index, base, suffix, digits)); @@ -2407,6 +2398,7 @@ public class GPreferences extends JPanel if (index == min + lowersurround && index < max - uppersurround - 1) { exampleSB.append("\n..."); + lineNumber++; } else if (index > min + lowersurround && index < max - uppersurround) { @@ -2421,6 +2413,7 @@ public class GPreferences extends JPanel else { exampleSB.append("\n"); + lineNumber++; } exampleSB.append(BackupFilenameParts.getBackupFilename(index, base, suffix, digits)); @@ -2449,6 +2442,18 @@ public class GPreferences extends JPanel } + // add some extra empty lines to pad out the example files box. ugh, please tell + // me how to do this better + int remainingLines = lowersurround + uppersurround + 1 - lineNumber; + if (remainingLines > 0) + { + for (int i = 0; i < remainingLines; i++) + { + exampleSB.append("\n "); + lineNumber++; + } + } + backupfilesExampleLabel.setText(exampleSB.toString()); } @@ -2572,11 +2577,7 @@ public class GPreferences extends JPanel protected void backupfilesCustomOptionsSetEnabled() { - // int scheme = getComboIntStringKey(backupfilesPresetsCombo); - // boolean enabled = scheme == BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM && - // enableBackupFiles.isSelected(); boolean enabled = customiseCheckbox.isSelected(); - //boolean enabled = customiseCheckbox.isSelected() && enableBackupFiles.isSelected(); backupfilesRevertButtonSetEnabled(enabled); backupfilesSuffixTemplateSetEnabled(enabled); -- 1.7.10.2