How to force Java/awt to use a specific toolkit (qt)?
Question
I am working on an embedded Linux device that has only qt. For some reason, Java decides to use gnu.java.awt.peer.gtk.GtkToolkit. How can I force it to use gnu.java.awt.peer.qt.QtToolkit instead (or change the default behavior)?
Solution
the api suggests setting the system property awt.toolkit,
java -Dawt.toolkit=gnu.java.awt.peer.qt.QtToolkit my.Program
or
System.setProperty ("awt.toolkit", "gnu.java.awt.peer.qt.QtToolkit");
OTHER TIPS
Also you can set the Default Toolkit inside of swing directly, in a compiler-friendly way.
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow