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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T05:37:26+00:00 2026-05-19T05:37:26+00:00

This my new MyJtable public void addWidget(Book w) { datalist.add(w); fireTableRowsInserted(datalist.size()-1, datalist.size()-1); } calling

  • 0

This my new MyJtable

public void addWidget(Book w) {
    datalist.add(w);
    fireTableRowsInserted(datalist.size()-1, datalist.size()-1);

   }

calling class

  MyJtable tv = new MyJtable(a);
        table = new JTable(tv);
        //tv.addWidget(b3);
        JScrollPane pane2 = new JScrollPane(table);

button CLick function

 public void actionPerformed(ActionEvent e)
   {
    MyJtable tv1 = new MyJtable();
    Book b3 = new Book ("Java nutshell-299", "Ajfdfdfdingya2") ;
    if("Add".equals(e.getActionCommand()))
  {
  JOptionPane.showMessageDialog(null,"Add button is clicked");
  tv1.addWidget(b3);
  }

when i click button then i don’t see any GUI chnage but if call

tv1.addWidget(b3);

   }

before , i mean on load then i can see the new book but not on button click

  • 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-19T05:37:28+00:00Added an answer on May 19, 2026 at 5:37 am

    I see that you add the row to a new table that you’ve just created inside the actionPerformed method. Usually, we use actions to change/alter already existing GUI components. This might be a reason why you don’t see any change on the GUI.

    I guess, the table that is displayed in the scroll pane is created with

    MyJtable tv = new MyJtable(a);
    table = new JTable(tv);
    

    Try adding the row to table (via tv which has to be made an instance variable first) instead of the newly created table.

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

Sidebar

Related Questions

I've this code to detect click on JTable table.addMouseListener(new java.awt.event.MouseAdapter() { @Override public void
This is how my JTable is reconstructed from the serialized data: table = new
I'm populating data from my database into my JTable. After I add new data
I normally save new data to the database like this: $this->MyTable->set(array( 'id' => $id,
I have this widget: $this->setWidget('slug', new sfWidgetFormDoctrineChoice(array('model' => 'MyTable', 'method' => 'myMethod', 'key_method' =>
Why does this: (new[]{1,2,3}).Cast<decimal>(); result in an InvalidCastException: Specified cast is not valid.
So there's this new cool thing, these NoSQL-databases. And so there's my data: Rows
Using mootools I have a regex like this: new RegExp('^([^\\D'+ separator +']+)(\\d{2})'); In a
So I'm trying out this new TDD thing (about time haha). Anyways I have
In ASP.net MVC4 there's this 'new' concept of a web API for exposing CRUD

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.