From 78daabcc6b478d861b3982754b8412e651cc8dc4 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Wed, 14 Jun 2023 23:23:32 +0100 Subject: [PATCH] JAL-4206 unified dimensions --- src/jalview/io/JalviewFileChooser.java | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/src/jalview/io/JalviewFileChooser.java b/src/jalview/io/JalviewFileChooser.java index ef7a2b8..fe01a69 100755 --- a/src/jalview/io/JalviewFileChooser.java +++ b/src/jalview/io/JalviewFileChooser.java @@ -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() -- 1.7.10.2