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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:44:41+00:00 2026-06-17T08:44:41+00:00

In my editor I have a LayersManager and a LayersView class. The LayersManager class

  • 0

In my editor I have a LayersManager and a LayersView class. The LayersManager class holds all the layers that the user is currently using (think Photoshop layers). The LayersView is a JPanel that lists the layers contained in the LayersManager.

What I would like to do is to update the LayersView JPanel by adding or removing a LayerComponent from the JPanel’s container whenever the add(Layer) or remove(Layer) methods are called from the LayersManager.

In other words, what I want is a reverse ChangeListener where whenever a change is made in the LayersManager, the LayersView is automatically contacted, adds or removes a LayerComponent from it’s container and invalidates itself.

So my questions are: Is there a standard built in listener to do this? Are listeners the right way to go? Or should I just include a reference to the LayersView inside the LayersManager and manually call the required methods (I suspect this is bad design)? I can’t think of a nice (design wise) way of implementing my own listeners.

Any help appreciated!

  • 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-17T08:44:41+00:00Added an answer on June 17, 2026 at 8:44 am

    You can use the Observer pattern. Java has built-in support for this pattern in the form of the Observable and Observer classes.

    Basically, your LayersManager would extend Observable and your LayersView would implement Observer. You would then call addObserver on the LayersManager and pass in your LayersView.

    Once that is in place you can call the following methods on your LayersManager whenever a change occurs that you want to notify the LayersView about:

    layersManager.setChanged();
    layersManager.notifyObservers();
    

    The notifyObservers method can take an object as a parameter if you want the Observer listeners to receive some data. Once notifyObservers is called, your LayersView will have the update method called.

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

Sidebar

Related Questions

I have editor settings that I want to spread in all repositories. If the
I have an editor which is in my window that contains a wrapping iframe
I have an editor I am attempting to emulate that has some very nice
i have an editor that is basic microsoft actions: createlink bold etc. i made
I have an editor that built as follows: EditorBuilder builder = context.Html.Telerik().Editor() .Name(ID) .Encode(false)
Hi I have text editor widget in smalltalk (visual works) that returns a text
I am using the div replace method to have an editor appear when text
I have editor that I can get it's code with js in my page
I am using tinymce editor to have html page and then insert it in
I'm looking for an editor/IDE that can provide features that are nice to have

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.