Back to LanguageTool Homepage - Privacy - Imprint

LanguageTool start using System Look and Feel


(Tiago F. Santos) #1

One of my pet peeves with LanguageTool (and Java in general) is Nimbus theme usage. It is completely out of place in any platform I know, either it is Windows XP, 7, 8+ or Linux. It just does not fit.

I looked in to the code that handled that, Nimbus was being defined for everything but OS X, since adding a theme would cause it issues.
The code to make this part of the program have a consistent UI in any OS is quite simple.

diff --git a/languagetool-office-extension/src/main/java/org/languagetool/openoffice/Main.java b/languagetool-office-extension/src/main/java/org/languagetool/openoffice/Main.java
index dcddb51..bf7c12c 100644
--- a/languagetool-office-extension/src/main/java/org/languagetool/openoffice/Main.java
+++ b/languagetool-office-extension/src/main/java/org/languagetool/openoffice/Main.java
@@ -710,12 +710,9 @@ public class Main extends WeakBase implements XJobExecutor,
// do not set look and feel for on Mac OS X as it causes the following error:
// soffice[2149:2703] Apple AWT Java VM was loaded on first thread -- can't start AWT.
if (!System.getProperty("os.name").contains("OS X")) {
- for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
- if ("Nimbus".equals(info.getName())) {
- UIManager.setLookAndFeel(info.getClassName());
- break;
- }
- }
+ // Cross-Platform Look And Feel @since 3.7
+ UIManager.setLookAndFeel(
+ UIManager.getSystemLookAndFeelClassName());
}
} catch (Exception ignored) {
// Well, what can we do...

I have tested it and it runs great.
Can I push this fix, or is this controversial?

PS - Now, it looks like this on Windows 7 and on my system with Mint-Y theme (GTK+) :


(Daniel Naber) #2

A post was split to a new topic: Cohesion flow and grammar


(Tiago F. Santos) #3

Seams like there is no issue with this change.
@dnaber Unless you object to it, I will push this change tomorrow. Only difference will be that I will leave the old code as a comment, for future reference.


(Daniel Naber) #4

No need for that, we can always check the history in git.


(Tiago F. Santos) #5

Perfect. Added.