Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Why is there a small gap at the top of the JCombo dropdown menu?  RSS feed

 
Peter Lock
Greenhorn
Posts: 24
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

I have two JCombo boxes - one with more values then the other. The one with more values doesnt have a small gap at the top and bottom of the popup, the one with less items does. My question: how can I remove the extra space at the top and bottom of the left side JCombo box popup? And whats causing it?


Regards

package gui.customer.com;

 
Rob Camick
Ranch Hand
Posts: 2800
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Works fine for me using JDK8 on Windows 7.

Some basic debugging techniques:

1. First test with default classes. No need for a custom renderer to demonstrate a problem.
2. Use the default fonts.
3. Use the default sizes

In other words first make sure the code works with default classes and values before making changes.

Then if it stops working you know which change is causing the problem.

Also, don't use a JLabel to reserve space. You can use an EmptyBorder on the panel. Read the section from the Swing tutorial on How to Use Borders
 
Peter Lock
Greenhorn
Posts: 24
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rob

Thanks for the advice. I went ahead and checked an example from 'The Definitive Guide to Swing' page 495 'List Modal Controls' - and even with a simple copy paste I had the same problem after removing half of the arrays data. Im using JDK8 on OSX. Thanks again for taking a look.

Regards
Screen-Shot1.png
[Thumbnail for Screen-Shot1.png]
Screen shot 1
Screen-Shot2.png
[Thumbnail for Screen-Shot2.png]
Screen shot 2
 
Paul Clapham
Sheriff
Posts: 22480
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aha. So it's Windows vs OSX, in other words the two of you are using different look-and-feels.
 
Peter Lock
Greenhorn
Posts: 24
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul

Yep, thats it. And with your help I have started customizing this project look and feel. Thanks again for your help

Regards
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!