This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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 ]
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