I am creating an RMI project but I am running into a problem when I go to display JOptionPanes. When updating the Clients from the server, my game is supposed to display a message to every player if someone won the game but the JOptionPane just shows a blank box with a title, no message or button. I can't figure out what I am doing wrong. I am thinking that it has something to do with threading but I am not that experienced yet.
Part of the code in the Client class:
Update method in the Server class:
I hope I have explained this well enough. Thank you for your help.
The client gets a reference to the server through the registry which the server binds itself to. The client then adds itself to a collection that the game has of every client so that it can call update on all of them. It is supposed to be an implementation of the observer pattern.
I have to refresh this topic because I have the same problem. I don't know why using RMI JOptionPane doesn't work. Anybody solved this problem?
Joined: Jan 08, 2010
I was working on this over a year ago for a school project, so its hard to recall what I did but looking at the code, it looks like I ended up scrapping the JOptionPane and just displaying the message in a text box on each client. Sorry I can't be of more assistance.
Joined: Apr 03, 2011
For this moment I replaced JOptionPane by JFrame with appropriate buttons. But I am still curious why this happen.