Solved

Getting started: JTable data validation

Posted on 2001-06-21
3
375 Views
Last Modified: 2010-05-18

I have to write a set of methods which validate the data entered into a JTable.

My starting point is a method which loops through the cells of a row and checks to ensure that:
1. Each cell is not empty, and
2. Each cell does not contains only spaces.

(From there I would like to highlight the offending cell(s) and show a dialog box -- a separate matter)

I have been unable to find examples of similar validation code, either in my many Java books, or on the web.

Please let me know if you know of ANY publicly available table validation code examples, or if you are willing to share any examples of your own.

Many thanks in advance.

0
Comment
Question by:pkl_javaq
3 Comments
 
LVL 1

Expert Comment

by:kuro
ID: 6217483
Use below 3 methods in TableModel which is retuend by JTable.dataModel() to iterate all values in table.
  getColumnCount()
  getRowCount()
  getValueAt(int, int)
0
 
LVL 5

Expert Comment

by:vemul
ID: 7621026
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
- To be PAQ'ed and points refunded
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

vemul
Cleanup Volunteer
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 7643109
PAQ'ed and points removed

modulo

Community Support Moderator
Experts Exchange
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Checkbox and ListView in Android Layout 4 67
custom annotations 9 39
couple of eclipse 5 38
servlet example 11 40
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question