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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:12:00+00:00 2026-05-24T20:12:00+00:00

I have a presenter class and several text fields in my view. I want

  • 0

I have a presenter class and several text fields in my view.

I want my presenter to say “every textfields that are listening to me, please do something now”.

BUT I don’t want to use Observabe/Observer, since I already use it and I don’t want to get confused.

To be a bit more specific, I want the textfields to update a Map in the presenter :

Presenter.java :

public class Presenter  {

   private HashMap<String,MyObject> map;

   theMethod(){
     //to all text fields, please update the map

Then a textfield in a panel :

JTextField tf = new JTextField("tf 1");
tf.//add something to listen to the presenter

The beginning of the process is the method in the presenter :

  1. theMethod() is called (not by the view)
  2. theMethod() triggers a method linked to the TextFields
  3. Every methods called in every TextFields are doing something
  • 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-24T20:12:01+00:00Added an answer on May 24, 2026 at 8:12 pm

    I found it !

    I use a Runnable callback in the presenter.

    In my view I have :

            presenter.setCallback(new Runnable(){
                public void run(){
                    System.out.println("the presenter want me to do something");
                    //stuff
                }
            });
    

    And in my presenter :

    private Runnable callback;
    
    public void theMethod(){
        System.out.println("I was triggered by another far away view");
        SwingUtilities.invokeLater(this.callback);
    }
    

    Of course, I’m going to implement some List for each textfield.

    In the end, I have the expected behavior :

    • Some methods dispersed in some places, but registered as callbacks
      in the presenter
    • The presenter now able to fire those methods
      when he wants to !

    Great !

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

Sidebar

Related Questions

I have an Entity with several fields: @Entity public class Leilighet { @Id @GeneratedValue(strategy
Ok say I have the following model: class Country < ActiveRecord::Base validates_presence_of :name validates_presence_of
I have a view controller that gets presented modally and changes some data that
I have traditionally implemented a Model-View-Presenter [Passive View] like so: interface IView { string
I have a message model and I want it to have several receivers, possibly
I'm working on a project in C# 4.0. I have several presenter classes, which
I have a class that is used as part of a financial application. The
I want to have the WPF controls inherited like this, public class BaseView :
I have a view that contains a UITableView and a UILabel which works perfectly
I have several models: User = an ordinary user class (does not belong to

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.