JAL-4206 unified dimensions
authorBen Soares <b.soares@dundee.ac.uk>
Wed, 14 Jun 2023 22:23:32 +0000 (23:23 +0100)
committerBen Soares <b.soares@dundee.ac.uk>
Wed, 14 Jun 2023 22:23:32 +0000 (23:23 +0100)
src/jalview/io/JalviewFileChooser.java

index ef7a2b8..fe01a69 100755 (executable)
@@ -51,6 +51,8 @@ import javax.swing.JScrollPane;
 import javax.swing.ListCellRenderer;
 import javax.swing.SpringLayout;
 import javax.swing.SwingConstants;
+import javax.swing.SwingUtilities;
+import javax.swing.border.TitledBorder;
 import javax.swing.filechooser.FileFilter;
 import javax.swing.plaf.basic.BasicFileChooserUI;
 
@@ -576,12 +578,6 @@ public class JalviewFileChooser extends JFileChooser
       list = new JList<>(recent);
       list.setCellRenderer(new recentlyOpenedCellRenderer());
 
-      /*
-      DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
-      dlcr.setHorizontalAlignment(DefaultListCellRenderer.RIGHT);
-      list.setCellRenderer(dlcr);
-      */
-
       list.addMouseListener(new MouseAdapter()
       {
         @Override
@@ -591,8 +587,11 @@ public class JalviewFileChooser extends JFileChooser
         }
       });
 
-      this.setBorder(new javax.swing.border.TitledBorder(
-              MessageManager.getString("label.recently_opened")));
+      TitledBorder recentlyOpenedBorder = new TitledBorder(
+              MessageManager.getString("label.recently_opened"));
+      recentlyOpenedBorder.setTitleFont(
+              recentlyOpenedBorder.getTitleFont().deriveFont(10f));
+      this.setBorder(recentlyOpenedBorder);
 
       final JScrollPane scroller = new JScrollPane(list);
 
@@ -602,20 +601,11 @@ public class JalviewFileChooser extends JFileChooser
       layout.putConstraint(SpringLayout.NORTH, scroller, 5,
               SpringLayout.NORTH, this);
 
-      // TODO are we now all using FlatLaf -- check same dimensions for
-      // everyone?
-      if (Platform.isAMacAndNotJS())
-      {
-        scroller.setPreferredSize(new Dimension(280, 100));
-      }
-      else
-      {
-        scroller.setPreferredSize(new Dimension(500, 200));
-      }
-
+      // one size okay for all
+      scroller.setPreferredSize(new Dimension(280, 105));
       this.add(scroller);
 
-      javax.swing.SwingUtilities.invokeLater(new Runnable()
+      SwingUtilities.invokeLater(new Runnable()
       {
         @Override
         public void run()