Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force Java/awt to use a specific toolkit (qt)?

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)?

like image 953
bgw Avatar asked Jan 06 '10 20:01

bgw


2 Answers

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");
like image 116
Alexander Torstling Avatar answered Sep 22 '22 06:09

Alexander Torstling


Also you can set the Default Toolkit inside of swing directly, in a compiler-friendly way.

UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
like image 37
jayunit100 Avatar answered Sep 25 '22 06:09

jayunit100