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

  • Home
  • SEARCH
  • 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 7064133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:47:48+00:00 2026-05-28T04:47:48+00:00

I have an application with a main JFrame that contains a default list model.

  • 0

I have an application with a main JFrame that contains a default list model. I want that if I modify something on these records, the second running application is automatically updated.

So far I have a MainController class which implements the listener and overwrites the update method:

public class MainController implements ActionListener, Observer {
  public void update(Observable o, Object o1) {}
}

and a simple class that extends Observable

public class Comanda extends Observable{}

My problem is that if I delete one record from the first application, the second list doesn’t update. The program is deleting the record from the text file but is not updating the default list model. Same problem with edit or add.

I tried adding “reloadList()” in the update method, but that doesn’t work. Ideas?

  • 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-28T04:47:49+00:00Added an answer on May 28, 2026 at 4:47 am

    Have you called addObserver on Comanda and added the MainController as an Observer? Also, when the change occurs are you calling setChanged and notifyObservers?

    Looking at the code you have posted I can see that you have not wired the Observer and Observable Objects together. As I said, you have to call addObserver on your Observable object, then within your Observable Object, whenever a change is made you need to call setChanged then notifyObservers. Only when notifyObservers is called will the update method of any Observers that have been added be called.

    You said in your question that when you delete one record the list doesn’t update, which makes me think that Comanda is probably not the Object that you want to Observe. Whichever Object it is that holds the List of records is the one that should be the Observable.

    Have a look at this for some more information on the Observer/Observable pattern.

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

Sidebar

Related Questions

I have my main application delegate which contains a method that returns an object.
I have a java main application, and I want to use log4j. I don't
I have an application where I have a main.m that returns NSApplicationMain(argc, (const char
I have a List in the main application and I am trying to access
I have a java application that can be run as a JFrame or as
I have my main application ,from my main application I will be calling another
I have a main application, and a bunch of sub-applications (they are separate apps,
Events are synchronous in C#. I have this application where my main form starts
I have an Air application with a main window. I would like to have
I have an application composed of a main view and a secondary view which

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.