Get your CodeRanch badge!*
The moose likes Beginning Java and the fly likes A question about GUI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "A question about GUI" Watch "A question about GUI" New topic
Author

A question about GUI

Shen Lin
Greenhorn

Joined: Mar 10, 2003
Posts: 10
I wrote a simple Client/Server program. It is able to send messages between two computers. Now I want to build user interface for this program. There is a "Apply" button on the interface and it will pop out a small window with two text fields for typing in socket number and server's host name. The related code and my problem is described below:

Thanks very much.
[ edited to remove big long unbroken line within code block -ds ]
[ March 17, 2003: Message edited by: Dirk Schreckmann ]
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
I am a bit confused. You already have a gui that has an Apply button. Why is the input field not on THAT GUI? Then when you hit the Apply you would do the processing.
However, in this scenario, if this is the code in the listener for the original Apply button, and it is supposed to present a pop-up with input fileds, then the code for what to do after the text fields are filled in should not be in here.
You need to have an "OK" button or something on your pop-up dialog, and have a separate listener for THAT which holds the logic on how to handle the input values.
The important thing is that you separate the place where you create your GUI components, and the logic for what happens when your button is pressed. Don't create GUI components inside the listener logic.
[ March 17, 2003: Message edited by: Cindy Glass ]

"JavaRanch, where the deer and the Certified play" - David O'Meara
Shen Lin
Greenhorn

Joined: Mar 10, 2003
Posts: 10
Thanks very much. I fixed it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A question about GUI
 
Similar Threads
help with interface, static counter - RMI?
problem with program
Help Client Server implementaion
Can't catch Window Close event when trying SocketServer trying to accept connections
Multiple threads writing and reading from single socket