Advertisement

[java] Problems with a dialog box

Started by November 13, 2000 11:47 PM
2 comments, last by Neurotic 24 years, 1 month ago
Heya everyone, This is a situation. I''m building a java Board/card game that is networked. There is a board with pieces on it, and each player has a hand that they can use to do different things One of the aspects of the game is this: An action on the board occurs (i.e. a piece is going to move) The players are all asked if they want to respond (i.e. their hand is displayed, with an extra pass option), they then click on the desired card, or they can hit the pass button. A Player can see his card in a non-modal dialog box he can pop up when he chooses, and also pops up in a query state when asked to by the server. The only thing is this... if one player plays a card, I need to be able to shut down the other player''s ability to see his cards. (if that makes sense) so that only one player can respond to the event, in a first come first served scenario. E.g. Player A''s piece moves. Both player B and player C have cards that can cancel it, and therefore both are notified at the same time. Player B plays a card to cancel the action. Player C should now no longer be able to play a card. This is the ideal situation, but it is not what is happening. when a appropriate card is played, all players are sent a message that, when interpreted, "shuts down" the dialog box(i.e. turns off the query ability, and setVisible(false)) to do this I''ve tried two things: option a) I had the box modal(true) so that the system would wait for user input. However, this meant that I could not call any methods on it, until it stopped being modal and was visible. (I even tried setting it to non-modal from a variety of outer classes, and nope, nothing worked). option b) I have the Dialog object in a loop, that waits for a flag to be set to true that a option has been picked. (i.e. passed == true), in theory what I hoped to be able to do, is externally set passed == true, and thus stop the loop... and then hide the dialog box... however, this has not worked either. I am truly at wits end here so any help would be appreciated. Thanks, Mark ---- www.emanatemultimedia.com ----
<< ...and here is one we developed earlier... >>
you kind of explained what you''re trying to do, but I don''t understand what your problem is.
Advertisement
Sorry, brain''s not totally working.

My problem is this.

Once the server sends out a message to all players, basically saying "hey, close that window, as someone else has played a card"

What should happen, is the client recieves and interprets the message, and the modal/looping dialog box should close.

However, it doesn''t.

The client only runs this AFTER a button has been pressed on the dialog box, and sets Visible(false) internally.

Its very frustrating.

Mark

----
www.emanatemultimedia.com
----
<< ...and here is one we developed earlier... >>
To anyone who is possibly reading this:

I think I''ve disocovered the issue.

When setting a dialog box to modal, it stops ALL the threads that are currently running under that program, except for the thread that the dialog is currently running on.

I think I''ve worked out a alternate way to solve this issue never the less.

(Just FYI)
Mark



----
www.emanatemultimedia.com
----
<< ...and here is one we developed earlier... >>

This topic is closed to new replies.

Advertisement