Sagewire Logo

JTable (setForeground on text in cell)

2 Message(s) by 2 Author(s) originally posted in java gui


From: ":-o" Date:   Sunday, September 23, 2007
Thanks,

Based on Events/conditions , I need to set the text in a JTable cell from
default color (black) to background color (white) to "hide" the text. These
conditions will force back/forth to the foreground coloring.

Is any one cell containing text a JTextField or JLabel?

How'd I get a reference to the component to make the setForeground() call.

Thanks again.....


From: Andrew Thompson Date:   Sunday, September 23, 2007
wrote in message:
.
Based on Events/conditions , I need to set the text in a JTable cell from
default color (black) to background color (white) to "hide" the text.



You best bet is to implement your own
JAVAx.swing.table.TableCellRenderer, but note
that it'd probably be better to simply have
the returned component contain an empty String,
based on 'Evensts/Conditions' otherwise if the
user selects the cell/text, the text will become visible.

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via http://www.JAVAkb.com



Next Message: Gridbag Layout. Fixing size of a component



Programming | Sports | Autos

copyright 2006
Valid XHTML 1.0 Transitional