🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #15068

Re: How to set custom font or foreground/background color for a grid cell?

#15068
From: Tor Iver Wilhelmsen
Date: Thu, 15 Jul 1999 00:00
32 lines
1576 bytes
"Santichai Emyoo" <semyoo@access.inet.co.th> writes:

> I need to set custom font or foreground/background color for a grid cell,
> only one cell, in the grid.

public class MySpecialCellRenderer extends 
  javax.swing.table.DefaultTableCellRenderer {

  public int x,y;

  public MySpecialCellRenderer(int _x, int _y) {
    x = _x;
    y = _y;
  }

public Component getTableCellRendererComponent(JTable�table,
                                               Object�value,
                                               boolean�isSelected,
                                               boolean�hasFocus,
                                               int�row,
                                               int�column) {
    if (row == y && column == x) {
      // Do the special modifications here
      return this;
    }
    else
      return super.getTableCellRendererComponent(table, value,
                                               isSelected hasFocus,
                                               row, column);
  }

}
Technical Details
Message-ID: <uiu7mdxn2.fsf@sds.no>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7mii6u$35a9@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f74b3,2cdcc7ed8282b923
X-Google-Attributes: gidf74b3,public
From: Tor Iver Wilhelmsen <tor.wilhelmsen@sds.no>
Subject: Re: How to set custom font or foreground/background color for a grid cell?
Date: 1999/07/15
Message-ID: <uiu7mdxn2.fsf@sds.no>
X-Deja-AN: 501276450
Sender: towi@SDSA1761
References: <7mii6u$35a9@forums.borland.com>
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.language