*
The moose likes Swing / AWT / SWT and the fly likes fill color in alternating rows in jtable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "fill color in alternating rows in jtable" Watch "fill color in alternating rows in jtable" New topic
Author

fill color in alternating rows in jtable

cchetan jain
Ranch Hand

Joined: Jul 05, 2009
Posts: 30
I have made a object of JTable.but now i want to avoid user editing and set the color to the alternate tables..
but problem is that this code gives the compile time error.
now how can i do it.
one solution to this problem is that i extends the JTable and override these methods..and then make a object of that..
bt i want to ask that is there another solution for that.
;
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> I have made a object of JTable.

where?

this line doesn't count
JTable jTable1=new jTable1();

there is no standard class called jTable1.

post what you really have, not merrily typing away from memory, and you might get a solution.

anyway, the code, in the right order, worked OK for me (alternating white/gray rows)

[edit]
and duplicating your post in Beginning Java, will just annoy 2 sets of people
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: fill color in alternating rows in jtable