my dog learned polymorphism
The moose likes Sockets and Internet Protocols and the fly likes hand over number from gui to client class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "hand over number from gui to client class" Watch "hand over number from gui to client class" New topic

hand over number from gui to client class

Anders Kviback
Ranch Hand

Joined: Mar 21, 2011
Posts: 45

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?

Sachin H. Gupta

Joined: Oct 10, 2012
Posts: 17
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 agree. Here's the link:
subject: hand over number from gui to client class
It's not a secret anymore!