JDK-5006246 : JCombobox doesn't get resized according to font size change
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.0,5.0
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: generic,windows_nt
  • CPU: generic,x86
  • Submitted: 2004-03-02
  • Updated: 2023-01-13
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Description
Combobox don't get resized according to font size if L&F is changed at zero font size and than font size is increased again
Steps to reproduce:
1) Run the attached testcase TestResizeBehaviour
2) Click on "Decrease font size" button till you see on
   console font size as Zero.
3) Now change the Look and Feel to some other Look and Feel(Say motif) by going
   in Look and feel menu. Notice that checkbox size remains unchanged but
   changin L&F changes size of Combobox
4) Now click sometimes on increase font size button to give font size of 10
   Notice: Checkbox will regain its old size and display text properly,
   But combo box appears still small and don't gain any size.

Reproducible on tiger beta2 b40

Comments
EVALUATION Name: sh120115 Date: 03/03/2004 This appears to have broken in 1.4.0. JComboBox isn't resizing itself even after revalidate() is called. I believe the problem is that we're not recalculating the display size on font changes. Adding the line: isDisplaySizeDirty = true; to the PropertyChangeListener in BasicComboBoxUI, in the "font" case, fixes the problem. Will let the responsible engineer for JComboBox determine if this is the correct fix. ###@###.### 2004-03-03 ====================================================================== Name: sh120115 Date: 03/09/2004 The zero font size and LAF switching is not the issue here. It is simply that JComboBox doesn't recompute its preferred size when the font is changed. See 5007717 for another test case. ###@###.### 2004-03-09 ====================================================================== One other thing to note. The propertyChangeListener for "font" size changes does a validate(). I would think it should be revalidate(). This was mentioned in duplicate bug 6244041. ###@###.### 2005-03-31 19:35:16 GMT
31-03-2005