1

I have made a window, some buttons and a textfield in Scene Builder.

In Scene Builder: enter image description here

But when I run my program via netbeans or double clicking on the .jar file, its runs fine but just the color does not show. Background becomes white. And specially the textfield, I created it dark color, it also becomes white. You can understand my problem if you check the secreenshots.

After running the program: enter image description here

There is no error in my code. I do not understand why it is happening so. It supposed to show the exact color which is defined by me. Can anyone help me?

You can also see my fxml code here http://pastebin.com/1sif2Dsq

Tushar Monirul
  • 4,944
  • 9
  • 39
  • 49

1 Answers1

0

As I suspected, you forgot to save your file after changing style. In my SceneBuilder it looks exactly as on 2nd picture. Save your FXML file before exporting your project to jar file.

Also, as a sidenote. Consider to use some layout manager instead of AnchorPane which uses absolute positioning for your components.

Branislav Lazic
  • 14,388
  • 8
  • 60
  • 85