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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:40:35+00:00 2026-06-03T19:40:35+00:00

In a Swing project, I have used a JFrame and divided it into three

  • 0

In a Swing project, I have used a JFrame and divided it into three parts: a menu pane, a context pane, and a status pane.

The status pane shows to the user whether his actions was successful or not, along with other information that the user might want to know, upon taking an action. For example, if the user clicks a delete button in the context menu, the status panel indicates whether the operation was done successfully.

The problem with the status panel is that it needs to update its status after a while. For instance, if the user clicks on another button or navigates through other pages in the context pane, the status pane shouldn’t be still showing the results of the last delete operation.

There are two workarounds for this, that I can think of:

  1. clear the status after a few seconds.
  2. add an mouse or keyboard action listener to all of the components(JPanels, JTextFields, and …) so that they call the status panel to clear the status, upon an activity from the mouse or keyboard.

Although implementing the first option is relatively simple, but it’s not enough. I think I need a combination of the two. However the problem is that it would be a very dirty approach if I want to add these action listeners to all the components. Maybe I can add it to the main frame. I did (the code is given below), but if works only if the mouse is moving on the frame’s own panel (not on the context pane, for example)

Do you have any suggestions?

    JFrame.this.addMouseMotionListener(new MouseMotionListener() {

        @Override
        public void mouseDragged(MouseEvent me) {
        }

        @Override
        public void mouseMoved(MouseEvent me) {
            Config.statusPanel.clearStatus();
        }
    });
  • 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-03T19:40:36+00:00Added an answer on June 3, 2026 at 7:40 pm

    No, using a MouseListener for this is kind of crazy, and you yourself say that it’s a dirty solution. Instead I think you’re much better off using a PropertyChangeListener to listen to the states of your classes, most likely the Model class, and none of the view classes.

    For example, the user pushes a JButton (a component in the view class), the control class reacts to this button push and tells the model to change its state. Your status pane’s PropertyChangeListener will then respond to the model’s state change and update its own view. It’s the cleanest most OOPs way to solve this problem.

    For this to work well, your program should be based on one of the variants of the model-view-controller pattern, but then it should be doing this anyway.

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

Sidebar

Related Questions

In my java-swing project. I have one frame in which user can drop the
I maintain Autoit project used for automated testing of swing app. Those tests have
I have a swing project and noticed that the elements inside the JFrame is
I have a simple question. I have a project made with javax.swing.JFrame. I would
I'm working for a Swing Project and the technologies used are netbeans with Toplink
I'm working on a project that needs Jasper reporting, I have used the code
I have to develop a Swing Project. I need to access the database in
I'm working on a project about graph-coloring (with GUI). I have a map divided
I have been working on Java Swing project. Its design is pretty poor. I
I have a college project based on java swing. I wanted to use windowbuilder

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.