• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
shri hari
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • 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?

 
Paul Clapham
Sheriff
Posts: 22718
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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.
 
Campbell Ritchie
Marshal
Posts: 56223
171
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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: 56223
171
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thanks Campbell Ritchie.
 
Campbell Ritchie
Marshal
Posts: 56223
171
  • Mark post as helpful
  • send pies
  • 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
  • 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: 56223
171
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!