5 ms·
Also, GTK is the "native" GUI toolkit on most Linux distros, whereas a Java-based one is almost guaranteed to look out of place.
by RussianCow 9y ago
Also, GTK is the "native" GUI toolkit on most Linux distros, whereas a Java-based one is almost guaranteed to look out of place.
- pjmlp 9y agoJava uses GTK bindings on Linux.
- RussianCow 9y agoI don't know about JavaFX, but I'm almost certain Swing uses its own UI components and doesn't use the native GTK ones, unless that has changed very recently.
- pjmlp 9y agoIt changed when Java moved from AWT to Swing. https://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html https://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/... --------------------------------------------------------- |Platform | Look and Feel | --------------------------------------------------------- |Solaris, Linux with GTK+ 2.2 or later | GTK+ | |Other Solaris, Linux | Motif | |IBM UNIX | IBM* | |HP UX | HP* | |Classic Windows | Windows | |Windows XP | Windows XP | |Windows Vista | Windows Vista | |Macintosh | Macintosh* | --------------------------------------------------------- Apparently not many bother to learn how to take advantage of Swing APIs.
- LukeShu 9y agoThat's what `SystemLookAndFeel` is, which is not the default Look and Feel in the JRE; `MetalLookAndFeel` is, which is what people think of when they think of Java applications. (1) Most Java applications don't set the LAF, (2) most distros don't set the default LAF (in /etc/profile.d/), and (3) most users don't know to set the default LAF. And saying all applications should set it to SystemLookAndFeel would be wrong, as they should respect the user's settings if they exist. _JAVA_OPTIONS='-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel'
- pjmlp 9y agoHence my remark, > Apparently not many bother to learn how to take advantage of Swing APIs.
- djsumdog 9y agoI just ran my old swing app for years ago and it still displays using its own toolkit. I think you're thinking for SWT (the toolkit used by Eclipse) which will use native components for each OS. SWT is kinda difficult to use and last time I checked, all the Scala bindings/wrappers were crap or non-existant, making it a non-starter for me.
- pjmlp 9y agoStarting with Java 9, JEP 283: Enable GTK 3 on Linux http://openjdk.java.net/jeps/283 http://openjdk.java.net/jeps/283 Opening paragraph "Java on Linux currently uses GTK 2. This raises several issues:" The problem are the ones too lazy to call, UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); https://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html https://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/...
- jessaustin 9y agoWhat problems would it cause if the runtime just called that automatically?
- pjmlp 9y agoThe usual traditional backwards compatibility story of Java, if I remember correctly. When it was introduced they didn't want to break the L&F of AWT applications, then they also added multiple ways of enabling it. So a good application should respect the system wide or user specific settings if available, instead of just blindly use whatever L&F it feels like. Also although many complain about how Swing looks like, the API is actually quite powerfull and skinnable, even if it requires some graphic programming skills to achieve it, for example see JGoodies or UltraMixer DJ.
- tomc1985 9y agoGTK is indeed native