Threads and GUIs

Ok, I'm working on a program to be used by a campground, keeping track of customers, campsites, and reservations. The problem I'm running into is in my code. I have a main GUI that opens at the start of the program, and from there other GUI's can be opened through the toolbar. I'm completely new to threads, and I know I need to use them, but I've had a bit of bad luck finding the information I'm looking for on their use.

One thing that needs to be done is information must be passed between the GUI's. For example, MainGUI is opened at the onset of the program, then the FindEditCustomerGUI is opened. From there, CustomerSearchGUI is opened and a customer is found from the database given the criteria established in the FindEditCustomerGUI and displayed in the table. The customer is selected, and Found Customer button is pressed, and the customer object needs to be sent back to the FindEditCustomerGUI.

I've spent two hours searching for information on how to do this, but have come up with nothing. Any help on how to use threads and how to pass information back and forth would be greatly appreciated.
khsanthAsked:
Who is Participating?
 
JavatmConnect With a Mentor Commented:
> Any help on how to use threads and how to pass information back and forth would be greatly appreciated.

Actually I dont see any need for thread related task to what your doing.

> From there, CustomerSearchGUI is opened and a customer is found from the database given the criteria
> established in the FindEditCustomerGUI and displayed in the table.

What you can do is find the records 1st from FindEditCustomerGUI then you can re-output the result to
CustomerSearchGUI by passing the same parameters you can do this in many ways like file I/O.
Depends on your style.

> The customer is selected, and Found Customer button is pressed, and the customer object needs to
> be sent back to the FindEditCustomerGUI.

Same you can do whatever style you want. Doing a file I/O can help, I'll give you an example :

// Example you entered a value = 0001
JTextField t1 = new JTextField();

// t1 here is your JTextfField
" SELECT * FROM YOURTABLE WHERE IdNumber = t1.getText ";

Then you can file output the value w/c is 0001 and re-use. Hope you get my point.

Hope that helps . . .
Javatm
0
 
khsanthAuthor Commented:
I see what you're getting at. Is there a way to do it with threads?
0
 
objectsConnect With a Mentor Commented:
> Is there a way to do it with threads?

You should *not* use threads for a GUI application unless you have some long task that needs to be performed.
0
 
khsanthAuthor Commented:
Thanks for the prompt replies and for steering me down the right path. I'll have to confer with my group and come up with a new course of action, which means I might be asking more questions later.
0
 
JavatmCommented:
http://freewebs.com/cube-j

Always glad to help . . .
Friend : Javatm
0
All Courses

From novice to tech pro — start learning today.