This week's book giveaway is in the Java in General forum.
We're giving away four copies of Helidon Revealed: A Practical Guide to Oracle’s Microservices Framework and have Michael Redlich on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

hand over number from gui to client class

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello!

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?

Anders
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
See where your hand is? Not there. It's next to this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic