Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6059761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:44:53+00:00 2026-05-23T08:44:53+00:00

I am doing a project in java swing in which I have to use

  • 0

I am doing a project in java swing in which I have to use a JTable.
By default jtable can validate the inputs (float,int) by turning into red when wrong input is given.
But I want to validate the empty cell left in the table at the time of save button click.

Here is my code:

public boolean validCheck() {

    if (jTable.getCellEditor() != null) {
        jTable.getCellEditor().stopCellEditing();
    }

    for (int i = 0; i < jTable3.getRowCount(); i++) {
        for (int j = 0; j < jTable3.getColumnCount(); j++) {
             String val = jTable3.getValueAt(row, col).toString();

             if (val.trim().length() == 0) {
                return false;(joptionpane.showmessagedialog(null,"field empty");)
             }
        }
    }

    return true;
}

This code is checking all the rows in the table and displaying the field empty message. I need to check only filled rows(rows which have data) not all the rows in the jtable.

Any suggestions would be helpful.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:44:54+00:00Added an answer on May 23, 2026 at 8:44 am

    You need to change your logic to first look if a row had data at all. Then (and only then), take a second pass to validate that all columns in that row are filled.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing a project in Java which includes (x,y) coordinates. I have created a
I'm doing another Java project for my class. In this assignment, we have to
I've been tasked with doing refactoring to a Java Swing application we have here
I'm doing a project in seam that requires restful URLs. I have a view
I'm doing an AutoLisp project which uses long associative structures to do heavy geometrical
I have a project I am doing some maintenance work on and have got
I have a Java GUI project containing a JMenuBar and I just added a
I am doing project on java. In one of the class, I am working
I was doing a project in a Java book and came across this code
Now we have a project with java 1.4 and ejb 2.1 running on jboss

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.