Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable (no double values)

 
tom1978
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to check that in my Table(a special number or Titel) can only be inserted once in the table.
It should not be possible to insert the same Number in other cells.
Perhaps you have some good advise.
Greetings
tom
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"tom1978" -

Welcome to the JavaRanch! Please adjust your displayed name to meet the
JavaRanch Naming Policy.
You can change it here.

The best way to perform the function you want is to make a new TableModel that tests all input. You can just extend DefaultTableModel and override the methods that allow table data to be set to test the data first. You may be able to just override the newDataAvailable( TableModelEvent ) method and test the new data in that one method.

Thanks! and welcome to the JavaRanch!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!