Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Regarding JComboBox width size

 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a doubt in JComboBox, i want to display JComboBox width size and and its contents width size must be the same, i am using setMinimumSize() and setPreferredSize(), it doesn't works, only height can be reflecting but not width, is there any alternate way to do this ? can you please help me. if i minimize the JComboBox width size means JPanel size is automatically shrinked.

Thanks in advance
 
Rancher
Posts: 3205
29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We don't have enough information to suggest a solution. The problem may be related to the layout manager you are using.

For more more post your SSCCE that demonstrates the problem.
 
tadi raja
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
actually i have a main panel and have 3 sub panels, top panel covers the entire frame, left panel contains some components like JComboBox,radio buttons and some labels, the combobox takes large width when combobox popup data has a smaller text, the only reason for that it takes larger width for entire left panel,i am using setMinimumSize() and setPreferredSize() to reduce the size for combo boxes, the height will reflecting but not the width, my idea is if i reduce the combo box width, the left panel size is automatically shrinked, please give me any suggestion about this.

thanks in advance
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> please give me any suggestion about this.

once again you've been told how to get a solution, by posting your code.
and, again, all you want to do is see everyone else's posted code.

I'm sure the problem is identifiable by all reading this thread,
but the exact solution requires you to post your code so we can see what
layoutManager you are using, and HOW you are using it.

why is it you cannot grasp this simple concept, which has been pointed out to you
numerous times in the past.
 
tadi raja
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am using GrigBag Layout for this one
 
Sheriff
Posts: 21999
107
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just show an SSCCE as Michael asked you.
 
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One of the reasons you should create a simple example, is you may find that in the simple example it works correctly. This will allow you to begin adding in application parts until you find what is actually causing the problem. It's a win-win scenario. Additionally, it provides you with an opportunity to improve your debugging skills.
 
You'll never get away with this you overconfident blob! The most you will ever get is this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic