Results 1 to 7 of 7
  1. #1
    Melki is offline Member
    Join Date
    Jun 2008
    Posts
    20
    Rep Power
    0

    Default Perform one action at a time

    Dear all,

    When I click a button in my Swing application then it should be made that no other actions can be performed using the mouse until that action is completed.

    Please give your ideas regarding this.

    Thank you.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    what do you mean by "no other actions can be performed using the mouse"? Do you mean that other buttons and components are not enabled until some action is complete? Can you post a small compilable program that shows an idea of what you're trying to do?

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    To the original poster, cross-posting can frustrate anyone who tries to help you only to find out later that the same answer was given hours ago in a cross-posted thread. No one likes wasting their time, especially a volunteer. The polite thing to do would be to not do this, but if you feel that you absolutely must, to at least provide links in both cross-posts to each other.

    Freeze the GUI on a button click process. (Swing / AWT / SWT / JFace forum at JavaRanch)

  4. #4
    Melki is offline Member
    Join Date
    Jun 2008
    Posts
    20
    Rep Power
    0

    Default

    I am having a GUI where i will be having four or five buttons more than that i will be having a tree also. For each buttons there will be an action called, on the same time in the tree also on selecting each node of the tree an action will be performed. So when the user clicks one of the buttons then I should not allow him to click other buttons until the action of this(clicked) button is completed. Also I should not allow him to click the nodes of the trees also.

    I hope this will give you an idea.

    Thank you.

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Since I have no idea if someone else is giving the same suggestion elsewhere in a cross-post and am not in the mood to do futile work, I'm dropping this thread. Best of luck.

  6. #6
    jacob6900 is offline Member
    Join Date
    Nov 2008
    Posts
    5
    Rep Power
    0

    Default

    I am assuming you are using the MouseClicked event. Using the ActionPerformed should (depending on your jre version) keep the mouse down until the functions within its scope are complete. A hack I have used before is to create a Boolean canClick, set it to false on click, then when all functions are complete set it to true. The other buttons would check this and if false, they would not click.

  7. #7
    Melki is offline Member
    Join Date
    Jun 2008
    Posts
    20
    Rep Power
    0

    Default

    Thank you jacob it seems as a good idea, I will work on it but does java has any objects that would seperately monitor the changes in the GUI. Because if such an Object exist means then I hope it will be usefull to us in many ways.

    Thank you.

Similar Threads

  1. Replies: 21
    Last Post: 08-01-2008, 11:13 AM
  2. How to perform some event to button click
    By eva in forum AWT / Swing
    Replies: 2
    Last Post: 01-16-2008, 12:27 AM
  3. Run RCP action from outside of the Eclipse RCP
    By leonbandas in forum Eclipse
    Replies: 1
    Last Post: 01-07-2008, 07:15 AM
  4. jsp:forward action
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-24-2007, 10:04 AM
  5. Few action in one Jbutton
    By kubiasty in forum New To Java
    Replies: 0
    Last Post: 07-25-2007, 10:19 AM

Posting Permissions

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