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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:27:31+00:00 2026-05-26T00:27:31+00:00

Swing uses Actions to share functionality and state across multiple GUI components like menu

  • 0

Swing uses Actions to share functionality and state across multiple GUI components like menu items and toobar buttons. XUL uses a similar approach with their Command framework.

What are typical/best approaches to handle similar requirements in GWT? I’m particularly interested in showing whether a menu item or a button is enabled or disabled.

  • 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-26T00:27:32+00:00Added an answer on May 26, 2026 at 12:27 am

    I use the Command class. GWT MenuItems can have a Command associated with them. Here are some relevant code fragments:

    Command printCommand = new Command() {
          @Override
          public void execute() {
            myEventBus.fireEvent(new PrintEvent());
          }
        };
    
    MenuItem print = new MenuItem();
    
    print.setCommand(printCommand);
    

    Notice that you can cause printCommand to execute simply by calling printCommand.execute(). For instance, you can have a print Button for which the ClickHandler calls printCommand.execute(), so it has the same effect exactly as the menu item in the above code.

    Now I know in Swing there is a clever interaction between the Action and the Widget so that all the Widgets are enabled or disabled at the same time by enabling or disabling the Action. The Command is not so tightly tied in, and I don’t think there is anything in GWT like what you have in Swing for that sort of one-stop enable/disable feature. Having said that, you might be able to extend Command so that you somehow register widgets that fire that command with the command, and the command has a enable methid that, when called, walks through the list of widgets enabling and disabling them as required.

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

Sidebar

Related Questions

I'm trying to write a nice GUI in Swing that uses the proper Model-Delegate
I have a GUI application in swing, implemented in NetBeans. For the various functionality
I have implemented a standalone java application which uses the swing framework for GUI.As
I'd like to recreate a functionality similar to a Swing GlassPane to be able
I'm going to make an application (in Swing) that uses a tree to visualize
To put it simple: a swing app that uses sqlitejdbc as backend. Currently, there's
I have a swing gui with a tabbed pane in the north. Several key
I have a swing application that includes radio buttons on a form. I have
I can see how Swing uses Decorator and Observer pattern. Observer: Every component(eg. JButton
I have a small Java desktop app that uses Swing. There is a data

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.