🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

JList and HTML

#8012
From: Adrian Tarau
Date: Tue, 07 Nov 2000 00:00
36 lines
1430 bytes

    HI,

I want to display HTML texts in a JList component. The oice of source for
render is bellow

class HtmlRender extends JEditorPane implements ListCellRenderer {

      public HtmlRender() {
        super();
        setOpaque(true);
        setEditorKit(new HTMLEditorKit());
        setContentType("text/html");
      }

      public Component getListCellRendererComponent(JList list, Object
value, int index,
          boolean isSelected, boolean cellHasFocus) {
        if (isSelected) {
         setBackground(list.getSelectionBackground());
         setForeground(list.getSelectionForeground());
       }
       else {
         setBackground(list.getBackground());
         setForeground(list.getForeground());
       }
        setText((String)value);
        System.out.println(value);
        return this;
      }
}

The problem is that I get only empty rows ( the text want render )

Does anybody know where is the problem ?
Technical Details
Message-ID: <8u91d4$cat8@bornews.inprise.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,43b61e30fdb3cf30,start
X-Google-Attributes: gid111d45,public
From: "Adrian Tarau" <ady@datagroup.ro>
Subject: JList and HTML
Date: 2000/11/07
Message-ID: <8u91d4$cat8@bornews.inprise.com>
X-Deja-AN: 690787473
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
Organization: Level 7
X-MSMail-Priority: Normal
Newsgroups: borland.public.jbuilder.java.swing