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 8438081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:36:35+00:00 2026-06-10T07:36:35+00:00

I built a jTable using NetBeans GUI, and I want to update it inside

  • 0

I built a jTable using NetBeans GUI, and I want to update it inside the constructor of the class. I’m planning to add a search option on the frame so the whole update idea is quite critical for me.

My code:

    public availableTrumps(TrumpistClient TC){
    initComponents();
    availableTrumpsTrumpistClient=TC;
    String result=null;

    String query="SELECT * FROM APP.TRUMPS";

        result=this.availableTrumpsTrumpistClient.WritingReading("sql_select", query);

        if (result.contains("empty")){
            JOptionPane.showMessageDialog(this, "There are now trumps to show.");
        }
        else if (result.contains("error")){
            JOptionPane.showMessageDialog(this, "Error in the connection. Please try again.");
        }
        else{
            int i;
            String []data = result.split("\r\n");
            String [][] data2 = new String [data.length][];
            for (i = 0; i < data.length; i++)
            {
                data2[i] = data[i].split("&");
            }
            String[] columnNames = {"From", "To", "Departure Time", "Remaining Places", "Proposer", "ClosingTime", "Cost Per Seat" };
            this.jTable1 = new JTable(data2,columnNames);
            this.jTable1.setPreferredScrollableViewportSize(new Dimension(500,100));
            this.jTable1.setFillsViewportHeight(true);
            JScrollPane jps = new JScrollPane(jTable1);
            add(jps);
            jTable1.revalidate();

    }

    }

The input two-dimentional array data2 is fine and validated.
I added the last 5 rows of the code to see if they help with something. I don’t know if they are mandatory and in any case I do not want to change the graphical properties of the jTable I built with the GUI (just the data in it).
When I run the program, I see that the jTable remains empty.
Why?

  • 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-06-10T07:36:36+00:00Added an answer on June 10, 2026 at 7:36 am

    I suggest you use a table model, whenever the data changes you change the model. Build the JTable instance only once, not whenever you need to change the data.

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

Sidebar

Related Questions

In a Java Swing app (built in Netbeans 6.9), I have a JTable with
Using the Netbeans GUI builder, is it perhaps a synchronization, thread or pass by
I built the opencl program using the commands: gcc -c -I ~/AMDAPP/include main.c -o
I built a linear layout inside of a dialog , the problem here that
I built my app using Grails 2.0.4 and tested it in Jetty. In Jetty
i built my own infinitescroll similar to the google image search. Everythings works fine.
Good evening I have a JTable that I built with a TableModel how to
Built a custom app that will allow users to add jobs to a system.
I built a simple voting system: votes_controller.rb: class VotesController < ApplicationController def vote_up @post
I built a new FlowDocument Paragraph B by examining/using elements of an existing Paragraph

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.