Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

abstract table view in GUI

Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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


jesal dosa
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

Posts: 3648
Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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"?
expectation is the root of all heartache - shakespeare. tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic