aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes How to customize JTable to look something like this? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to customize JTable to look something like this?" Watch "How to customize JTable to look something like this?" New topic
Author

How to customize JTable to look something like this?

Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 598
I'd like to make a professional JTable style for the sales report. Any good links that can get me started?
The major question is how do I set the value of individual cell?



[Thumbnail for table layout.png]

K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2409
    
    7

Is your app a GUI or just a report? If the latter then I suggest you look into Jasper Report and build the layout.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 598
hi
it needs both a gui and a printed one
i wonder how to control individual cell width color indentation underlining etc
thanks
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2409
    
    7

I think the top 2 sections can be a bunch of labels or text output. The real table is the one at the bottom... also I see you have a + in one those columns allowing user to expand/collapse. This you will need a JTree inside JTable.

Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1083
    
  10

K. Tsang wrote: I see you have a + in one those columns allowing user to expand/collapse. This you will need a JTree inside JTable.

Right. You need to use a tree-table component for that. SwingX(from SwingLabs) provides a JXTreeTable component for the same - I think NetBeans has a Outline component for the same.

And for the coloring, you need to write custom renderers. You can read about renderers here


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to customize JTable to look something like this?