🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Set Image to TableHeader ???

#9405
From: Ernesto Bascon Pantoja
Date: Tue, 11 Apr 2000 00:00
53 lines
1828 bytes
Hi:

I implemented a class that extends JLabel and implements a
TableCellRenderer.
In this class, I did override the getTableCellRendererComponent()
method.
Something like this:


class MyTableHeaderRenderer extends JLabel implements TableCellRenderer
{
  Icon arrowUp   = new ImageIcon(icon1);
  Icon arrowDown = new ImageIcon(icon2);
  public Component getTableCellRendererComponent(JTable table, Object
value,
                            boolean isSelected, boolean hasFocus, int
row, int column)
      {
	 setBorder(yourBorder);
         switch (column)
         {
           case -1: setIcon(null);
                    setFont(yourFont1);
                    break;
           default: setFont(yourFont2);
                      if (order == NORMAL)
                         setIcon(arrowDown);
                       else
                         setIcon(arrowUp);
         }

         setHorizontalAlignment(JLabel.CENTER);
         setText(value.toString());
         return this;
      }
    };

}

Saludos

Ernesto B.





--
------------------------------------------
      What you dream is what you are

Polimorf's Page:     http://166.114.106.63
------------------------------------------
Technical Details
Message-ID: <38F38B50.B9293DBC@ucbcba.edu.bo>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <8chrs4$jpc1@bornews.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,5ec6b97b8654eea1
X-Google-Attributes: gid111d45,public
From: Ernesto Bascon Pantoja <bascone@ucbcba.edu.bo>
Subject: Re: Set Image to TableHeader ???
Date: 2000/04/11
Message-ID: <38F38B50.B9293DBC@ucbcba.edu.bo>
X-Deja-AN: 609799364
Content-Transfer-Encoding: 7bit
References: <8chrs4$jpc1@bornews.borland.com>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: UCB
Mime-Version: 1.0
Reply-To: bascone@ucbcba.edu.bo
Newsgroups: borland.public.jbuilder.java.swing