• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Problem with components in GridBagLayout  RSS feed

 
Greenhorn
Posts: 23
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: 23
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: 23
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]
 
Rancher
Posts: 2934
19
  • 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.
 
Marshal
Posts: 59757
188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. . . and welcome to the Ranch
 
Andrzej Zahorski
Greenhorn
Posts: 23
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!