• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with components in GridBagLayout  RSS feed

 
Andrzej Zahorski
Greenhorn
Posts: 11
IntelliJ IDE Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have problem with JLabel and JTextfield not taking up horizontal space as I planned. Something shrink them down, and broadening the panel or frame does not help with that.
Please help me with understanding why those those things doesn't work and what to do to fix that thing.
 
Andrzej Zahorski
Greenhorn
Posts: 11
IntelliJ IDE Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's screenshot of my app
 
Andrzej Zahorski
Greenhorn
Posts: 11
IntelliJ IDE Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
,
Screen-Shot-2017-10-12-at-02.04.22.png
[Thumbnail for Screen-Shot-2017-10-12-at-02.04.22.png]
 
Rob Camick
Ranch Foreman
Posts: 2822
15
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't use setPreferredSize() on any component.

Each component is responsible for determining its own preferred size.

It is the job of the layout manager to determine the preferred size of a panel based on the preferred size of the components added to the panel.
 
Campbell Ritchie
Marshal
Posts: 56223
171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. . . and welcome to the Ranch
 
Andrzej Zahorski
Greenhorn
Posts: 11
IntelliJ IDE Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello to you and all of the folks!  And thanks for the tip of course.
I'm happy to be in this place with similar feeling, when you  travel somewhere and spot previous unknown, amazing place on the way to destination

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!