From: Charles Ofoegbu Date: Wed, 4 Feb 2015 05:39:03 +0000 (+0000) Subject: JAL-1643 Modified JalviewFileChooser to have a more native laf on mac X-Git-Tag: Jalview_2_9~86^2~6 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=d4a690ec5b8ed7480d830e7a81cef9935c9b3a91;p=jalview.git JAL-1643 Modified JalviewFileChooser to have a more native laf on mac --- diff --git a/.classpath b/.classpath index f87dd26..1714959 100644 --- a/.classpath +++ b/.classpath @@ -48,12 +48,12 @@ - + diff --git a/lib/libquaqua.jnilib b/lib/libquaqua.jnilib new file mode 100644 index 0000000..a3c9e8a Binary files /dev/null and b/lib/libquaqua.jnilib differ diff --git a/lib/libquaqua64.jnilib b/lib/libquaqua64.jnilib new file mode 100644 index 0000000..5378540 Binary files /dev/null and b/lib/libquaqua64.jnilib differ diff --git a/lib/quaqua-filechooser-only.jar b/lib/quaqua-filechooser-only.jar new file mode 100644 index 0000000..429fe77 Binary files /dev/null and b/lib/quaqua-filechooser-only.jar differ diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index ff1b180..42202dd 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -49,6 +49,7 @@ import java.util.Map; import java.util.Vector; import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; /** * Main class for Jalview Application
@@ -91,12 +92,23 @@ public class Jalview System.out.println(System.getProperty("os.arch") + " " + System.getProperty("os.name") + " " + System.getProperty("os.version")); - if (new Platform().isAMac()) - { - System.setProperty("com.apple.mrj.application.apple.menu.about.name", - "Jalview"); - System.setProperty("apple.laf.useScreenMenuBar", "true"); - } + // if (new Platform().isAMac()) + // { + // // System.setProperty("com.apple.mrj.application.apple.menu.about.name", + // // "Jalview"); + // // System.setProperty("apple.laf.useScreenMenuBar", "true"); + // try + // { + // UIManager.setLookAndFeel(ch.randelshofer.quaqua.QuaquaManager + // .getLookAndFeel()); + // System.out + // .println("--------------------------------------------> in here"); + // } catch (UnsupportedLookAndFeelException e) + // { + // // TODO Auto-generated catch block + // e.printStackTrace(); + // } + // } ArgsParser aparser = new ArgsParser(args); boolean headless = false; @@ -172,6 +184,21 @@ public class Jalview } catch (Exception ex) { } + if (new Platform().isAMac()) + { + System.setProperty("com.apple.mrj.application.apple.menu.about.name", + "Jalview"); + System.setProperty("apple.laf.useScreenMenuBar", "true"); + try + { + UIManager.setLookAndFeel(ch.randelshofer.quaqua.QuaquaManager + .getLookAndFeel()); + } catch (UnsupportedLookAndFeelException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } if (!headless) { diff --git a/src/jalview/io/JalviewFileChooser.java b/src/jalview/io/JalviewFileChooser.java index df8decf..f0e0cb1 100755 --- a/src/jalview/io/JalviewFileChooser.java +++ b/src/jalview/io/JalviewFileChooser.java @@ -39,6 +39,7 @@ import javax.swing.JList; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; +import javax.swing.SpringLayout; /** * Enhanced file chooser dialog box. @@ -260,6 +261,7 @@ public class JalviewFileChooser extends JFileChooser public RecentlyOpened() { + String historyItems = jalview.bin.Cache.getProperty("RECENT_FILE"); StringTokenizer st; Vector recent = new Vector(); @@ -292,7 +294,17 @@ public class JalviewFileChooser extends JFileChooser this.setBorder(new javax.swing.border.TitledBorder(MessageManager.getString("label.recently_opened"))); final JScrollPane scroller = new JScrollPane(list); - scroller.setPreferredSize(new Dimension(130, 200)); + + SpringLayout layout = new SpringLayout(); + layout.putConstraint(SpringLayout.WEST, scroller, 5, + SpringLayout.WEST, this); + layout.putConstraint(SpringLayout.NORTH, scroller, 5, + SpringLayout.NORTH, this); + + // scroller.setPreferredSize(new Dimension(130, 200)); + + + scroller.setPreferredSize(new Dimension(500, 100)); this.add(scroller); javax.swing.SwingUtilities.invokeLater(new Runnable()