• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

How to add an option "None" or "None of the above" to a JTable in Java?

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to use of the following piece of code. But want to modify or extend it to provide an option "none" or "none of the above" at the end of the table. The output of the code is given at this url
[/img]. I want to have a value = none or none of the above instead of Row 20. How do I achieve it?

 
Sheriff
Posts: 28401
100
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch, shri!

You know the part of the code where you added those 20 rows to the table? Add a bit more code to add that extra row.
 
Marshal
Posts: 80673
478
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome again
Moving discussion because it will fit better in our GUIs forum.
 
shri hari
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Campbell Ritchie,
Do you want me to move the thread to GUI forums?
 
shri hari
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry for the quoting the post. I am newbie to ranch and wanted to edit the post, accidentally quoted it.
 
Campbell Ritchie
Marshal
Posts: 80673
478
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I often make that sort of mistake myself, so don't worry about it. Goodbye unnecessary post. I have moved the thread; the forum name is no longer shown as Beginning Java.
You can't edit posts: please post a new post with the changes in. You probably don't need to quote the whole of old posts.
 
shri hari
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Campbell Ritchie.
 
Campbell Ritchie
Marshal
Posts: 80673
478
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's a pleasure

Did you work out how to add “None of the above”? Presumably you would want a radio button with no action/option attached.
How are you going from radio buttons to options? Are you iterating an array of buttons? I am not convinced that would be an elegant solution; I can think of various other possible implementations.
 
shri hari
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am still working on it. I do not have any concrete implementation for "none of the above" as of now. I would consider your latest reply and think on it's lines.
 
Campbell Ritchie
Marshal
Posts: 80673
478
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Iterating an array would be a procedural programming solution. The object‑oriented solution would be to associate some sort of object representing the option with the button. The Listener associated with the button can activate the option, or put it in some situation where it will be executed next.

I think that is enough of hints: show us when you have got something working.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic