aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes abstract table view in GUI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "abstract table view in GUI" Watch "abstract table view in GUI" New topic
Author

abstract table view in GUI

jesal dosa
Ranch Hand

Joined: Jun 25, 2007
Posts: 46
Hi All,

I hope so one can help. I am extracting information from the search method which brings back results in the form of a String[][].
There for my data model is in the form String [][]. I would like to display some of the columns with slightly better formatting at the moments its all being displayed as plain text. I know there is a method that needs to be over ridden. I have seen examples where the following as been used



but all my data has been stored as String[][]

There is some thing about using Custom Renderers, but i am not sure how do implement that. I have been looking at the swing examples on the sun website.
How would I, for example take my columns which have either y or n to be displayed as check boxes. Any ideas. If there is a tutorial explaining how to do this or if some can point me in the right direction.Or can i leave the formatting as it is? Will i lose marks on the GUI, i would preferred to implement this because it would be a good learning experience

Regards

Jes
jesal dosa
Ranch Hand

Joined: Jun 25, 2007
Posts: 46
Hi all,

rendering example

The above link seems to have the information required. It shows how to create a render and attach it to a column

K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2503
    
    8

Hi Jes, if you are storing your data in a 2-D String array, then I expect it will definitely output as String class no matter what. Since your getColumnClass() calls getAtValue() method, you can customize your getAtValue method to display accordingly.

I see 2 ways to do it:
1) create a OO version of your data and use that object to populate the table
2) do the conversion in your getAtValue() method

Oh do watch out for "null"s when generating the table. If you do, physically returning the class in your getColumnClass will do the trick.

Does your find method really return a "2D array"?

K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5 OCPBCD5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: abstract table view in GUI