• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

abstract table view in GUI

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

Regards

Jes
 
jesal dosa
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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"?
 
If you are using a rototiller, you are doing it wrong. Even on this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic