IDE vs. commandline: Java look and feel inconsistent --- try with 1.1.4

Asked by Samuel Norman on 2018-09-19

When running a sikuli file from the IDE it defaults to the system look and feel:

SikuliIDE.java line 964: "UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());"

But when I run a sikuli file from the command line the look and feel is set to "javax.swing.plaf.metal.MetalLookAndFeel."

I use java GUIs that are kicked off by the sikuli script and this causes issues with the consistency of finding and working with the displays.

I know I can change the look and feel in my java GUIs, but is there a way to set the look and feel from the sikuli script itself so it can be an umbrella and change everything at once?

My current solution is convoluted, I run a java script at the beginning of the sikuli script that changes the look and feel. But I'm looking for a more elegant and easier to maintain solution.

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2018-09-19
Last reply:
2018-09-19
RaiMan (raimund-hocke) said : #1

Apparently you are using an older version of SikuliX.

In the current version in both cases (starting the SikuliX IDE GUI or running a script from commandline)

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); (org.sikuli.ide.Sikulix::prepareMac())

is only used once and only on Mac systems (I doubt, it is necessary at all ;-)

So you might test with the new 1.1.4.

If this does not help, the only way to get it right for you, is to run your scripts using Jython directly from commandline and have sikulixapi.jar on Java classpath.
... but the convenience (https://github.com/RaiMan/SikuliX-2014/wiki/Jython-in-IDEs-like-Eclipse-or-running-it-from-commandline) does only work up to Java 8.

With Java 9+ you have to find your own way.

Can you help with this problem?

Provide an answer of your own, or ask Samuel Norman for more information if necessary.

To post a message you must log in.