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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:08:04+00:00 2026-06-13T19:08:04+00:00

Method A in Class A (Non GUI) public void add() { if(etc…) { add

  • 0

Method A in Class A (Non GUI)

public void add() {
   if(etc...) {
      add data to a arraylist ..... 
   }
   Class B.updateTable();
 }

The method above basically adds data to a arraylist and then updates the tableViewer in class b.

Class B – GUI Dialog

Before I call Class B.updateTable(), I would like to check and make sure that Class B’s GUI is open and not disposed.

The user can use Class A(non gui) without Class B GUI being open. Because Class A builds a user selected ArrayList and Class B displays it. So they can add data without ever trying to display it.

If I run B.updateTable() currently and Class B is not open, I get a widget disposed error.

If I can add a check and make sure the widget is not disposed before I try to update the table.

Can I check the value from Class A or do I need to write a static boolean method is Class B that returns something like shell.isDisposed?

Then in Class A method I could just add the check.

  public void add() {
     if(etc...) {
        add data to a arraylist ..... 
     }
     if(!Class B.isShellDisposed()) {       
        Class B.updateTable();
     }
  }

Is this possible or even the right way to handle the error?

  • 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-13T19:08:06+00:00Added an answer on June 13, 2026 at 7:08 pm

    The issue I was having was refreshing my table viewer, while the GUI was closed. When my user would close the GUI to add more data to the arraylist via the Main Application. I had code in the add method to refresh the table viewer in the GUI. The main problem was even though the GUI was closed, the table viewer was not null. So my code was trying to refresh something that was already disposed. Knowing I do not need to refresh the table viewer when the GUI is closed. I set the table viewer to null in the Close Button code. Then checked the viewer for null in the update method.

    static public void updateTableViewer() {
    
      if(getViewer() != null) {
         viewer.refresh();
      }
    }
    

    So now when the GUI is closed the table viewer is NULL and when it is open the table viewer is not null. This seems to work for me.

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

Sidebar

Related Questions

package gui; public class Solver { void solveIt(){ CubeGui.moveThat(); } } I am trying
I would like to return an arraylist from a non-class method in java, i
I have a non-static class called ImplementHeaderButtons which contains a non-static public method called
So in java, say you have a non-static method 'bar()' in an class 'Foo'.
I have a function in a utility class namespace GUI.code { public class Utility
I can not access public method of my class MyPanel which extends JPanel .
If a non-gui object constructor wires a local event handling method to the event
public class ProtectedClass { private String name; public static void changeName(ProtectedClass pc, String newName)
working on xcode I realized that if I create a non-void method, I call
I have a class X which has this method: void setRxHandler(void (*h)(int)); And I

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.