Forums Register Login
hand over number from gui to client class

I have an issue here regarding streams and server - client. This is an university course and it is my absolutely last exercise. And I just can't figure out the last part . Hopefully I will be able to explain the problem without showing the whole code. The server class sends a number, for example 14 + 27. In the gUI I have a JTextField where I put in the answer, i e 41. I then click on the send button in order to send the answer to the server. (I am the client). But this sending can't be done before I click the send button. And this is my problem. In the ClientgUI it looks like this:

And in the MathClient class it looks like this:

I mean; when the program in Mathclient has reached sendAnswer(number) it must stay there and not execute further. It has to start execute further when I click on the send button. I need the number to be "handed over" from the gui class to the client class. But how shall the sendAnswer method look like?

Hopefully you can follow me here.

Anyone? Or do I have to send more code?

What is mcn and what exactly does MathClient do ?

You can add some code in sendAnswer(number) to wait for an event and then send the code.
I yam what I yam and that's all that I yam - the great philosopher Popeye. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database

This thread has been viewed 771 times.

All times above are in ranch (not your local) time.
The current ranch time is
Mar 21, 2019 11:32:08.