File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Jtable Row color Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Jtable Row color" Watch "Jtable Row color" New topic

Jtable Row color

Shashika Thiran

Joined: Jan 22, 2009
Posts: 24
I have two Questiions.
Is there anyway to add data to jtable row by row?
I want to change the jtable some rows color when condition applied.How how do i do that?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10828

Check out DefaultTableModel. It has methods like addRow and insertRow which you can use.
You will need to provide a renderer for a table where you can define the background.

In case you are a newbie to swing, you might want to read this first

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
It is sorta covered in the JavaRanch Style Guide.
subject: Jtable Row color
It's not a secret anymore!