1

In netbeans designer it looks like this:

When I run the application it looks like this:

I am using cardLayout as main layout and cards use free design layout, there are multile cards but all of them are the same size like the first screenshot.

Ladas125
  • 265
  • 3
  • 14

1 Answers1

2

This is because of Nimbus look and feel is default for swing application.

For reference link to Oracle docs. https://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/index.html

The "look" of an application refers to its appearance. The "feel" refers to how the widgets behave.

Editing here since I don't have enough reputation to add a comment.

Refer: NetBeans (Java Swing): Set window size

Accepted Answer:

Even if you've set the size with minimumSize and preferredSize, you might have forgotten to call Window.pack() in which Swing will resize the components (and all of it's subcomponents) according to the sizes set.

You call it in your window (or whatever is building your window) after all the preferred sizes are set.

Community
  • 1
  • 1
JBaba
  • 590
  • 10
  • 30
  • Nimbus look and feel is perfectly fine, the problem is the giant space at the bottom. – Ladas125 Aug 06 '15 at 19:34
  • This is side effects of drag and drop. Provide code which is generated by neat-beans. – JBaba Aug 06 '15 at 19:43
  • So this was actually caused by Nimbus look and feel because there was a card with a lot of textfields and those textfields are much bigger in Nimbus than in Windows, when I set the look and feel to Windows, the running program looked excatly same as in the designer (without the large space). Thank you. – Ladas125 Aug 07 '15 at 11:17