• Post Reply Bookmark Topic Watch Topic
  • New Topic

Threads and inner classes  RSS feed

 
Rikard Qvarforth
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i hava a problem im writing a client server program. The problem is that in the client class i have a inner gui class that builts upp depending
on parameters requested from the server.
ex.
class client
void run(){
//initialise the socket
//get in/out streams
while(!close)
objectinputstream.readobject()//listens for new commands/or objects that the server may send
}
class inner{
//construct the gui when user clics on a button
?? now i cant get the readstream because its wheting for commands from server
?? so i get the out stream and request the parameters from the server this works fine
but how can the inner class now when its parameters has been recived ? or even better please tell me how to design this better
 
Greg Charles
Sheriff
Posts: 3014
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My best guess is you are want to read some parameters from a server, and use the values to populate a GUI. Is that right? I'm not sure where the inner class comes in though. You ask how the inner class can know when the parameters have been received. Well, there are various callback strategies in Java, but here you should just have the same process that is reading the parameters, populate and and display the GUI. Implement the GUI as separate classes though. There's no need for an inner class here.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!