Solved

Getting started: JTable data validation

Posted on 2001-06-21
3
350 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
copyEndy  challenge 15 55
topping1 challenge 7 51
wordcount challenge 11 75
JDeveloper 12c for 32 bit 4 34
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now