It's not a secret anymore!*
The moose likes Swing / AWT / SWT and the fly likes Text in Jcombobox is too small, but why? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Text in Jcombobox is too small, but why?" Watch "Text in Jcombobox is too small, but why?" New topic
Author

Text in Jcombobox is too small, but why?

Gynnad Paullussen
Ranch Hand

Joined: Jan 26, 2011
Posts: 49
Hello,

As you can see the text in the JCombobox is to small, but I don't know why.
I also tryed jCombobox_test.setpreferedsize() and setSize() but it both doesn't work



And in another GUI of me I had this, and that is what I'm looking for:

D. Ogranos
Ranch Hand

Joined: Feb 02, 2009
Posts: 214
You probably set a maximum size for the combo boxes somewhere. Can you post the code where you create them?
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

You shouldn't need to set either the preferredSize or the size. However, the layout you use and the way you set the size (or don't) of the enclosing Window/Container may influence the displayted size of a contained component.

To get better help sooner, post a SSCCE (Short, Self Contained, Compilable and Executable) example that demonstrates the problem.

Moving this thread to the GUIs forum.


luck, db
There are no new questions, but there may be new answers.
Gynnad Paullussen
Ranch Hand

Joined: Jan 26, 2011
Posts: 49
D. Ogranos wrote:You probably set a maximum size for the combo boxes somewhere. Can you post the code where you create them?


I have made a small other program, where the Combobox is also to small. Here is the code of that class. So you can see it by your own.



Thanks alot already!
D. Ogranos
Ranch Hand

Joined: Feb 02, 2009
Posts: 214
Can't compile this, as DialogLayout is unknown (I can't find this in the API either, is this a class written by you?). Since the layout heavily influences how things are drawn, I'd suggest looking at that class
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
the problem must be in the menu.

having read Darryl's link to the SSCCE, you obviously would not have included
the menu code if it was unrelated to the problem, ergo, it must be the problem.

Gynnad Paullussen
Ranch Hand

Joined: Jan 26, 2011
Posts: 49
D. Ogranos wrote:Can't compile this, as DialogLayout is unknown (I can't find this in the API either, is this a class written by you?). Since the layout heavily influences how things are drawn, I'd suggest looking at that class


Hello,

Sorry, for my very very late response, but here is my small project, only with the 2 classes that are needed and a small code where you can see 1 combox!

Smaller Project with the wrong combobox
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
are you required to use DialogLayout?

if not:
change jPanelRight3 to a BorderLayout
create a holdingPanel(new GridLayout(0,2,20,5))
add the comboBox and 3 x labels to the holdingPanel
add the holdingPanel to jPanelRight3 at BorderLayout.NORTH
Gynnad Paullussen
Ranch Hand

Joined: Jan 26, 2011
Posts: 49
Michael Dunn wrote:are you required to use DialogLayout?

if not:
change jPanelRight3 to a BorderLayout
create a holdingPanel(new GridLayout(0,2,20,5))
add the comboBox and 3 x labels to the holdingPanel
add the holdingPanel to jPanelRight3 at BorderLayout.NORTH


Thanks alot! I used the Dialoglayout only to get two rows in the panel. But I see now it can also with the Gridlayout!

You are my hero! :)
Gynnad Paullussen
Ranch Hand

Joined: Jan 26, 2011
Posts: 49
Michael Dunn wrote:are you required to use DialogLayout?

if not:
change jPanelRight3 to a BorderLayout
create a holdingPanel(new GridLayout(0,2,20,5))
add the comboBox and 3 x labels to the holdingPanel
add the holdingPanel to jPanelRight3 at BorderLayout.NORTH


I have still the problem here. And I now know what the problem is.

I have Java7, that is the problem.. Someone knows how I can fix this?

Because I distribute the program, and if some else has Java 7 whats going wrong?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Text in Jcombobox is too small, but why?
 
Similar Threads
Why am I getting a copy of a button in my JPanel?
class diagram for Election
Double text alignment
Polymorphism problem
Resize JFrame to fit image