4 ms·
I'm not a Ruby guy at all so forgive me if I'm missing something here but what would the benefit of using GTK+ be over using JRuby and utilizing JavaFX or even
by jetti 9y ago
I'm not a Ruby guy at all so forgive me if I'm missing something here but what would the benefit of using GTK+ be over using JRuby and utilizing JavaFX or even Swing?
- axaxs 9y agoMost linux desktops have GTK installed already, and ruby. So, you can create a quite small performant GUI this way. JRE is falling out of fashion in my experience as a default install. It's huge, slow to startup, and creates a larger install size.
- RussianCow 9y agoAlso, 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
- oblio 9y agoThe JRE has just become modular with Java 9 and it even has AOT compilation these days, plus it has tools to create packages for all OSes. As for slow startup, just be careful with library selection.
- bluesroo 9y ago> It's huge, slow to startup, and creates a larger install size. I think these tradeoffs are okay for backend services, but I agree that they don't belong in user-facing applications if it can be avoided.
- petre 9y agoWell, at least unlike Electron, you need a single JRE instance for all your apps.
- tomc1985 9y agoJavaFX is not native, it renders closer to Electron than WinForms/GTK/native That said JavaFX controls feel very nice. Like a foreign GUI, but a nice one
- jetti 9y agoAh ok I didn't know that.