2

[PROBLEM] I've build a GUI for my application in e(fx)clipse and exported it as a project .zip-file and executable .jar-file. I compiled it with Java 1.8 and installed the JDK 8 on another machine and ran the .jar. The application starts without error but the whole GUI is broken. All elements (textareas, buttons, etc.) seem to are double their normal size. (GUI was made by coding, no Screen Builder) I have no clue what's the problem here. If you need further information please ask. Thank you!

EDIT: There seems to be a much bigger problem. I've copy pasted a very simple JavaFX tutorial in eclipse and the same problem occurs. So it seems it's not the code but the JVM?

EDIT: Hit boxes for buttons (etc.) are at the right position and clickable. Just the visuals are broken. Setting default stylesheet didn't work.

EDIT: There are some machines with Win7 and same JRE and it works. I've reinstalled the JDK/JRE on the machine where it doesn't work but the problem still occurs. Has someone an idea how to fix this?

[SOLUTION] As @tomsontom pointed out: The graphics card wasn't compatible to JavaFX. You can fix this by java -jar -Dprism.order=sw your.jar. Relevant post: JavaFX strange rendering on Windows 7

Community
  • 1
  • 1
cmtjk
  • 359
  • 2
  • 12
  • Does your code exit with an `Exception`? And in this case, what's the `Exception` type? – Giulio Biagini Jan 19 '15 at 08:26
  • @GiulioBiagini There's no Exception but here's an image [Broken GUI](http://i.imgur.com/zJFGZOS.png). Application works still fine on the machine (Win8.1) I coded it, but on all other machines (Win7) it's broken. – cmtjk Jan 19 '15 at 08:38
  • 1
    ref this http://stackoverflow.com/questions/26653469/how-to-set-default-javafx-themes – Reegan Miranda Jan 19 '15 at 08:42
  • 1
    Can you link here the code of your `JFrame`? (use [pastee](https://pastee.org/)) – Giulio Biagini Jan 19 '15 at 08:49
  • @ReeganMiranda that seemed promising and it changed the style but still double the normal size. – cmtjk Jan 19 '15 at 08:50
  • 1
    Try this code as the first instruction in the `main()` function: `UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());`. Does the error still occur? – Giulio Biagini Jan 19 '15 at 09:07
  • @GiulioBiagini this doesn't work. but thanks for your help. I found out that there are a few Win7 machines where it works (same JRE). I think it's not the code. – cmtjk Jan 19 '15 at 09:27

1 Answers1

2

The most likely reason that it does not work is that on this very Win7 machine is that:

  1. The graphic card is not supported and FX is falling back to software rendering which may has a bug
  2. Something between JavaFX / DirectX and the graphic card is going wrong
tomsontom
  • 5,856
  • 2
  • 23
  • 21
  • That's an interesting point. I'll check that as soon as possible. – cmtjk Jan 19 '15 at 15:18
  • This was the problem. I could fix it. For other viewers with same problem look at [SOLUTION] at my post. Thanks @tomsontom ! – cmtjk Jan 20 '15 at 14:47