From 1c6fdc1a16098521f8be8e6e2fc9d97df6532494 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Mon, 10 Nov 2014 20:29:45 +0000 Subject: [PATCH] * set swing.crossplatformlaf property to Nimbus laf for all platforms --- installer/deb/filebot.sh | 2 +- installer/portable/filebot.sh | 2 +- installer/ubuntu/filebot.sh | 2 +- source/net/filebot/Main.java | 34 +++++++++------------------------- 4 files changed, 12 insertions(+), 28 deletions(-) diff --git a/installer/deb/filebot.sh b/installer/deb/filebot.sh index ddeeb0e0..ac1b1e6c 100644 --- a/installer/deb/filebot.sh +++ b/installer/deb/filebot.sh @@ -1,2 +1,2 @@ #!/bin/bash -java -Dunixfs=false -DuseGVFS=false -DuseExtendedFileAttributes=true -DuseCreationDate=false -Djava.net.useSystemProxies=false -Dsun.net.client.defaultConnectTimeout=10000 -Dsun.net.client.defaultReadTimeout=60000 -Dswing.crossplatformlaf=javax.swing.plaf.nimbus.NimbusLookAndFeel -Djna.nosys=true -Dapplication.deployment=deb -Dapplication.dir=$HOME/.filebot -Djava.io.tmpdir=$HOME/.filebot/temp -Djna.library.path=/usr/share/filebot -Djava.library.path=/usr/share/filebot -Dnet.filebot.AcoustID.fpcalc=/usr/share/filebot/fpcalc -jar /usr/share/filebot/FileBot.jar "$@" +java -Dunixfs=false -DuseGVFS=false -DuseExtendedFileAttributes=true -DuseCreationDate=false -Djava.net.useSystemProxies=false -Dsun.net.client.defaultConnectTimeout=10000 -Dsun.net.client.defaultReadTimeout=60000 -Djna.nosys=true -Dapplication.deployment=deb -Dapplication.dir=$HOME/.filebot -Djava.io.tmpdir=$HOME/.filebot/temp -Djna.library.path=/usr/share/filebot -Djava.library.path=/usr/share/filebot -Dnet.filebot.AcoustID.fpcalc=/usr/share/filebot/fpcalc -jar /usr/share/filebot/FileBot.jar "$@" diff --git a/installer/portable/filebot.sh b/installer/portable/filebot.sh index 25dcc3ad..221b7408 100644 --- a/installer/portable/filebot.sh +++ b/installer/portable/filebot.sh @@ -25,4 +25,4 @@ cd "$WORKING_DIR" export LANG="en_US.UTF-8" export LC_ALL="en_US.UTF-8" -java -Dunixfs=false -DuseGVFS=false -DuseExtendedFileAttributes=true -DuseCreationDate=false -Dfile.encoding=UTF-8 -Djava.net.useSystemProxies=false -Dsun.net.client.defaultConnectTimeout=10000 -Dsun.net.client.defaultReadTimeout=60000 -Dswing.crossplatformlaf=javax.swing.plaf.nimbus.NimbusLookAndFeel -Djna.nosys=true -Dapplication.deployment=portable -Dnet.filebot.AcoustID.fpcalc=fpcalc "-Dapplication.dir=$APP_ROOT" "-Djava.io.tmpdir=$APP_ROOT/temp" "-Duser.home=$APP_ROOT" "-Djna.library.path=$APP_ROOT" "-Djava.library.path=$APP_ROOT" -Djava.util.prefs.PreferencesFactory=net.filebot.util.prefs.FilePreferencesFactory "-Dnet.filebot.util.prefs.file=$APP_ROOT/prefs.properties" -jar "$APP_ROOT/FileBot.jar" "$@" +java -Dunixfs=false -DuseGVFS=false -DuseExtendedFileAttributes=true -DuseCreationDate=false -Dfile.encoding=UTF-8 -Djava.net.useSystemProxies=false -Dsun.net.client.defaultConnectTimeout=10000 -Dsun.net.client.defaultReadTimeout=60000 -Djna.nosys=true -Dapplication.deployment=portable -Dnet.filebot.AcoustID.fpcalc=fpcalc "-Dapplication.dir=$APP_ROOT" "-Djava.io.tmpdir=$APP_ROOT/temp" "-Duser.home=$APP_ROOT" "-Djna.library.path=$APP_ROOT" "-Djava.library.path=$APP_ROOT" -Djava.util.prefs.PreferencesFactory=net.filebot.util.prefs.FilePreferencesFactory "-Dnet.filebot.util.prefs.file=$APP_ROOT/prefs.properties" -jar "$APP_ROOT/FileBot.jar" "$@" diff --git a/installer/ubuntu/filebot.sh b/installer/ubuntu/filebot.sh index e91637fb..81638d11 100644 --- a/installer/ubuntu/filebot.sh +++ b/installer/ubuntu/filebot.sh @@ -2,4 +2,4 @@ APP_ROOT="/opt/filebot" JAVA_CMD="$APP_ROOT/jre/bin/java" -$JAVA_CMD -Dunixfs=false -DuseGVFS=true -DuseExtendedFileAttributes=true -DuseCreationDate=false -Djava.net.useSystemProxies=true -Dsun.net.client.defaultConnectTimeout=10000 -Dsun.net.client.defaultReadTimeout=60000 -Dswing.crossplatformlaf=javax.swing.plaf.nimbus.NimbusLookAndFeel -Djna.nosys=true -Dapplication.update=skip -Dapplication.deployment=usc -Dnet.filebot.UserFiles.fileChooser=JavaFX "-Dapplication.dir=$HOME/.config/FileBot" "-Dapplication.cache=$HOME/.cache/FileBot/ehcache.disk.store" "-Djava.io.tmpdir=$HOME/.cache/FileBot/java.io.tmpdir" "-Djna.library.path=$APP_ROOT" "-Djava.library.path=$APP_ROOT" "-Dnet.filebot.AcoustID.fpcalc=$APP_ROOT/fpcalc" -jar "$APP_ROOT/FileBot.jar" "$@" +$JAVA_CMD -Dunixfs=false -DuseGVFS=true -DuseExtendedFileAttributes=true -DuseCreationDate=false -Djava.net.useSystemProxies=true -Dsun.net.client.defaultConnectTimeout=10000 -Dsun.net.client.defaultReadTimeout=60000 -Djna.nosys=true -Dapplication.update=skip -Dapplication.deployment=usc -Dnet.filebot.UserFiles.fileChooser=JavaFX "-Dapplication.dir=$HOME/.config/FileBot" "-Dapplication.cache=$HOME/.cache/FileBot/ehcache.disk.store" "-Djava.io.tmpdir=$HOME/.cache/FileBot/java.io.tmpdir" "-Djna.library.path=$APP_ROOT" "-Djava.library.path=$APP_ROOT" "-Dnet.filebot.AcoustID.fpcalc=$APP_ROOT/fpcalc" -jar "$APP_ROOT/FileBot.jar" "$@" diff --git a/source/net/filebot/Main.java b/source/net/filebot/Main.java index 2147069e..67187f05 100644 --- a/source/net/filebot/Main.java +++ b/source/net/filebot/Main.java @@ -142,11 +142,10 @@ public class Main { initializeSecurityManager(); // update system properties + System.setProperty("http.agent", String.format("%s %s", getApplicationName(), getApplicationVersion())); + System.setProperty("swing.crossplatformlaf", "javax.swing.plaf.nimbus.NimbusLookAndFeel"); System.setProperty("grape.root", new File(getApplicationFolder(), "grape").getAbsolutePath()); - if (System.getProperty("http.agent") == null) { - System.setProperty("http.agent", String.format("%s %s", getApplicationName(), getApplicationVersion())); - } if (args.unixfs) { System.setProperty("unixfs", "true"); } @@ -168,35 +167,20 @@ public class Main { // CLI mode => run command-line interface and then exit if (args.runCLI()) { - // default cross-platform laf used in scripting to nimbus instead of metal (if possible) - if (args.script != null && !isHeadless()) { - try { - Class nimbusLook = Class.forName("javax.swing.plaf.nimbus.NimbusLookAndFeel", false, Thread.currentThread().getContextClassLoader()); - System.setProperty("swing.crossplatformlaf", nimbusLook.getName()); - } catch (Throwable e) { - // ignore all errors and stick with default cross-platform laf - } - } - int status = new ArgumentProcessor().process(args, new CmdlineOperations()); System.exit(status); } // GUI mode => start user interface try { - SwingUtilities.invokeAndWait(new Runnable() { - - @Override - public void run() { - try { - // use native laf an all platforms - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (Exception e) { - Logger.getLogger(Main.class.getName()).log(Level.WARNING, e.getMessage(), e); - } - - startUserInterface(args); + SwingUtilities.invokeAndWait(() -> { + try { + // use native laf an all platforms + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (Exception e) { + Logger.getLogger(Main.class.getName()).log(Level.WARNING, e.getMessage(), e); } + startUserInterface(args); }); } catch (InvocationTargetException e) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, e.getCause().getMessage(), e.getCause());