Hi,
I am implementing a JTable. Using TableModel and JScrollPane( the
usual).
JTable(32*3)
Vertical scroll bar ALWAYS
Horizontal scroll bar AS NEEDED
Problems:
1: Vertical scroll bar doesnt show up! What do i do?
2: I want to change the color of the table (not grid lines); its
background
i.e of all the individual cells. How?
3: For column 0 -- values are hardcoded(0 thru 31)
For column 1 -- will keep changing
For column 2 -- will keep changing
How do I do that? I know have to override getValueAt(), but what are
the first steps?
I do not want to make it user editable though.
Is Jtable right for the above?
4: Consider a JLabel. If I want to display a message to user and
depending on the action taken replace that by another message, 1 way
to do that is replace the old label by blank string then put in the
new message. Can't this be done in 1 step? Should i use anything else
that JLabel?
I am returning to Swing after 2 years. Thats why such newbie
questions. Have forgotten everything. :-(
Any help/comments are appreciated.
Sincerely,
v796
Jan Vettenburg - 25 Jan 2004 20:23 GMT
For your first question : myTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF).
For question 2 : create your own CellRenderer which is colored to your
preferred colour. Than ensure that all columns are painted with this cell
renderen
> Hi,
> I am implementing a JTable. Using TableModel and JScrollPane( the
[quoted text clipped - 36 lines]
> Sincerely,
> v796