Editable JComboBox overlay

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Editable JComboBox overlay

Postby jimjam » Mon Jun 15, 2009 5:05 am

Hi

Do you have an approach for dealing with an overlay on an editable JComboBox? The combo box's editor and caret often draw over the overlay. It doesn't look easy to override the repaint method of the combo box's editor.

Thanks
jimjam
 
Posts: 3
Joined: Mon Aug 11, 2008 7:53 am

Re: Editable JComboBox overlay

Postby JIDE Support » Mon Jun 15, 2009 7:06 am

Please try the solution in the following link for painting overlay in JComboBox.

http://forums.sun.com/thread.jspa?threadID=536903&tstart=2865

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Editable JComboBox overlay

Postby jimjam » Mon Jun 15, 2009 8:50 am

Thanks, but I'm afraid that doesn't appear to help. My problem is with an editable combo and a JIDE Overlayable.

Something like:

JComboBox combo = new JComboBox(items);
combo.setEditable(true);
JLabel attentionIcon = new JLabel OverlayableUtils.getPredefinedOverlayIcon(OverlayableIconsFactory.ATTENTION));
overlayableComboBox = new DefaultOverlayable(combo, attentionIcon, DefaultOverlayable.SOUTH_WEST);
overlayableComboBox.setOverlayLocationInsets(new Insets(3, 5, 3, 0));

The overlay looks just fine until the caret goes near and starts to erase it. For most controls, the documented solution is to override repaint() and call OverlayableUtils.repaintOverlayable(this). But that doesn't appear to work with an editable combo (because the combo's internal editor component needs repainting rather than the combo). In fact, the same problem occurs if the overlay is placed at the other end, over the drop button icon.
jimjam
 
Posts: 3
Joined: Mon Aug 11, 2008 7:53 am

Re: Editable JComboBox overlay

Postby JIDE Support » Mon Jun 15, 2009 10:06 am

Please try our OverlayableDemo. The major difference is that OverlayComboBox is used instead of JComboBox so that we can override the repaint method.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Editable JComboBox overlay

Postby jimjam » Mon Jun 15, 2009 10:45 am

The demo is working fine. But it hasn't got an editable combo with an overlay on it. When I change the combo to be editable (OverlayableDemo.java. line 540):

comboBox.setEditable(true);

my problem occurs.
jimjam
 
Posts: 3
Joined: Mon Aug 11, 2008 7:53 am

Re: Editable JComboBox overlay

Postby JIDE Support » Mon Jun 15, 2009 12:59 pm

Got you. I'm afraid it's hard to get a solution because JComboBox does not have a method like createTextField(). We have to override the repaint() method for the text area component so that overlayable can work.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 49 guests