🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #9642

Creating a combo box renderer for an editable JComboBox

#9642
From: Jeff Marendo
Date: Thu, 24 Feb 2000 00:00
28 lines
1488 bytes
Hello,

I'm interested in making a combo box renderer for an editable JComboBox, but
I'm looking for some pointers on how to do so.  I understand that I'll
likely have to implement the ComboBoxEditor interface to do this.  I want to
create the renderer so that I can change the default foreground and
background colors of items that are selected or not selected.  I imagine
that I'll need to get the JList portion of the combo box to do this, too.

Would I be on the right track to have something like:

public class EditableComboBoxRenderer extends JLabel implements
ComboBoxEditor {

  public EditableComboBoxRenderer ( ) {
    setOpaque(true);
  }

  public Component getEditorComponent( ) {
    // ?
    // get the list from the combo box first
  }
}

I know I'll need more than that, but I'm looking to see if this would be the
right approach.  Any suggestions would be appreciated.  Thanks.

Jeff
Technical Details
Message-ID: <8949k7$a0o9@bornews.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,78228e89b9612731,start
X-Google-Attributes: gid111d45,public
From: "Jeff Marendo" <marendoj@commos.com>
Subject: Creating a combo box renderer for an editable JComboBox
Date: 2000/02/24
Message-ID: <8949k7$a0o9@bornews.borland.com>
X-Deja-AN: 589496898
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
Organization: CommTech Corporation
X-MSMail-Priority: Normal
Reply-To: "Jeff Marendo" <marendoj@commos.com>
Newsgroups: borland.public.jbuilder.java.swing