Re: Different height at JComboBox editor and renderer
- From: "Babu Kalakrishnan" <bkk.ngroup@xxxxxxxxx>
- Date: 28 Aug 2006 10:36:53 -0700
Beaned wrote:
Thank for pointing me in the right direction! However looking at the
source for the javax.swing.plaf.basic.BasicComboboxUI class, wouldn't I
need to subclass this class and overrided the getDisplaySize() method
since this is where takes the maximum size of either the editor or list
renderer?
I tried implementing what I suggested above and it works but
unfortunately there is a catch. By subclassing BasicComboBoxUI I loose
the look and feel that I am currently using (reverts to metal look and
feel). Can I implement this change and still make it available to any
look and feel?
Unfortunately the answer is no. This (in my opinion) is one of the big
drawbacks of the swing framework - there's no single point where you
can override a certain behaviour in the UI area and allow it to
propagate to all look-n-feels.
In my opinion you'd be better off putting your custom sizing behaviour
in either a customized JComboBox subclass - (Or simply call
setPreferredSize on it). While the default behaviour of a JComponent is
to (rightly) ask the UI delegate to compute the preferred sizes, it
normally honors the preferred sizes set by the application at the
component level.
BK
.
- Follow-Ups:
- References:
- Different height at JComboBox editor and renderer
- From: Beaned
- Re: Different height at JComboBox editor and renderer
- From: Babu Kalakrishnan
- Re: Different height at JComboBox editor and renderer
- From: Beaned
- Re: Different height at JComboBox editor and renderer
- From: Beaned
- Different height at JComboBox editor and renderer
- Prev by Date: Re: Different height at JComboBox editor and renderer
- Next by Date: Re: AffineTransform.getScaleInstance question
- Previous by thread: Re: Different height at JComboBox editor and renderer
- Next by thread: Re: Different height at JComboBox editor and renderer
- Index(es):