Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 5091278
Votes 0
Synopsis JCOMBOBOX DOES NOT SHOW ALL TEXT IF THE ITEM IS TOO WIDE
Category java:classes_swing
Reported Against 1.4.1
Release Fixed
State 11-Closed, Not a Defect, bug
Priority: 4-Low
Related Bugs
Submit Date 24-AUG-2004
Description



The problem stems from the fact that a JComboBox does not show all the text if the item to be displayed is too wide. You can increase the default width of the combobox but that doesn't do much  customer  because the size of the string is unlimited and you don't want to handle that case.  If you have an idea of what the maximum width value is, you can use setPrototypeDisplayValue to give you a  customer  width right after you create the combobox.  But that's not much  customer  because you don't really want a combobox that stretches all the way across the screen.
     
My property pages are WsDescriptionWizardTab subclassed.  Other than
some WATextAreas in JScrollPanes having the scrollpane's preferred size being set to Dimension(240, 120)I set very few sizes and let the framework calculate appropriate sizes.  I'm trying to determine whether I need to set an explicit size on the combo-box and donĘt believe setting a size is the solution in the first place.

What's the problem I'm trying to solve?  The source repository path
can be arbitarily long and the text field is non-editable.  As a result for long path names the user has no easy way to see the trailing portion of the path.  So was the choice of a combox box inappropriate?   Is there a neat WA control I can use which behaves like a non-editable combo-box and which lets you see the trailing portion of the path.  Some more appropriate Swing control?  Some kind of dynamic tooltip which give the complete path name (if
not completely visible) of the combo-box item hovered over? I looked at WAComboBox, but didn't see anything to address this.  

======================================================================
Work Around



Two possible workarounds:

First, use the dynamic tooltip idea. Basically, you'd have to add a selection listener (or what ever it is that gets fired when the selection changes in a combobox) and change the tooltip accordingly.

The second alternative is more work but it's doable.  Extend the
ComboBoxUI.  If using WAComboBox extend its UIs.  In the BasicComboBoxUI there are two methods (which might be in an internal class) that you need to override.  They are createScroller and configureScroller. Modify create scroller to show the horizontal scrollbar as needed as opposed to never.  Also, you should really extend configureScroller to set the horizontal scrollbar to not focusable as well.
======================================================================
Evaluation
This is an interesting narrative, but it is not a bug. There's nothing being asked for here. Closing as not a bug.
  xxxxx@xxxxx   2004-08-24
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang