Results 1 to 3 of 3

Thread: Disable Buttons in a CommandGroup

  1. #1
    Join Date
    Aug 2004
    Posts
    9

    Default Disable Buttons in a CommandGroup

    I want disable all the buttons contained in a CommandGroup.

    CommandGroup.setEnabled(false)

    dont work.

  2. #2
    Join Date
    Aug 2004
    Location
    Melbourne, FL
    Posts
    2,794

    Default

    Currently commandGroup.setEnabled(boolean) will disable all group controls that are buttons; for example, a menu or a popup pull down menu. It will not cascade enabled state to all members of the group.

    The question is, does this cascade setEnabled make sense, and if so, what should be the contract for the method. Just disable the buttons associated with action command members? I think this would be good, but I don't think it should be default behaivior. The action commands really should know when they should be enabled/disabled themselves.

  3. #3
    Join Date
    Aug 2004
    Posts
    9

    Default

    If I want disable all the commands in the toolbar?

    I could do it rewriting setEnabled of CommandGroup

    Code:
        public void setEnabled(boolean enabled) {
            super.setEnabled(enabled);
            Iterator it = getMemberList().iterator();
            while (it.hasNext()) {
                GroupMember gcm = (GroupMember) it
                        .next();
                gcm.setEnabled(enabled);
            }
        }
    is the unique solution that see because
    getMemberList() is protected.

    Other solution?

    THANKS!

Similar Threads

  1. ShowViewMenu and toolbar buttons
    By lstreepy in forum Swing
    Replies: 6
    Last Post: Oct 9th, 2008, 09:55 AM
  2. Replies: 9
    Last Post: Apr 24th, 2007, 06:59 AM
  3. Mnemonic set on toolbar buttons
    By tdunn in forum Swing
    Replies: 0
    Last Post: Oct 5th, 2005, 01:39 PM
  4. ApplicationDialog and buttons
    By Xtreme in forum Swing
    Replies: 1
    Last Post: May 26th, 2005, 03:36 AM
  5. Replies: 1
    Last Post: May 23rd, 2005, 02:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •