wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Parsing a variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Parsing a variable" Watch "Parsing a variable" New topic
Author

Parsing a variable

Peter Phung
Ranch Hand

Joined: Dec 06, 2001
Posts: 138
Hi guys and girls,
I've written a class which creates an instance of a second class, which in turn creates an instance of a third class i.e.

I need to wait for a button press in class c before returning the value of Variable back to class a.
Can anybody tell me how i can do this.


Pete<br />"Reality is an illusion <br />brought on by a lack of <br />drink, drugs and smut"
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
You could do it by writing a constructor for class C which waits for the button to be pressed. But the design as a whole strikes me as a little bit strange. If you would get more concrete on what you want to accomplish, it would be much easier to propose an appropriate solution...


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Peter Phung
Ranch Hand

Joined: Dec 06, 2001
Posts: 138
I'm writing an FTP application with a database connection to allow the user to choose which file they want to download.
ClassA is the main GUI which controls the application.
ClassB is a query mask which takes user input and parses that information to classC
ClassC diaplays the results of the query in a table, from which the user can a file to download.
this filename is needed by classA for it to be able to download the file.
I hope that this explains what i'm trying to accomplish
I would appreciate any suggestions for a different approach or any solutions to my current problem.
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Peter Phung:
I'm writing an FTP application with a database connection to allow the user to choose which file they want to download.
ClassA is the main GUI which controls the application.
ClassB is a query mask which takes user input and parses that information to classC
ClassC diaplays the results of the query in a table, from which the user can a file to download.
this filename is needed by classA for it to be able to download the file.
I hope that this explains what i'm trying to accomplish
I would appreciate any suggestions for a different approach or any solutions to my current problem.

OK, what you seem to want to do is something like

This could be pseudocode for your ClassA, whereas UserInfoDialog would resemble ClassB and FtpFileChooser ClassC.
Does that help?
Peter Phung
Ranch Hand

Joined: Dec 06, 2001
Posts: 138
i think i need to explain my appliaction a bit clearer. My application is more than 3 classes. i will explain each class below
class a :
allows the user to select a file for uploading onto the FTP server.
opens a dialog to collect connectiion details and passwords.
Opens the FTP client(class c).
opens the database query tool(class b)
this class only collects data.
class b:
this creates the query for the database. The user inputs the search criteria and the class generates a query for the database and parses the query to class c.
Class c:
this class queries the database and displays all of the results in a table. When the user double clicks on the file name/clicks OK the file name needs to be parsed back to class a. This is so class a has the name of the file which the user wants to download. Class a then calls class d.
class d:
This is the FTP client. Handles both uploading and downloading of files.
I hope that this has explained my problem a bit clearer.
Thanks for the suggestions so far
[ May 22, 2002: Message edited by: Peter Phung ]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
So you want to use class B from class A to get data from class C?


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Peter Phung
Ranch Hand

Joined: Dec 06, 2001
Posts: 138
I've found a solution to my problem. Here's the code that i used:

[ May 23, 2002: Message edited by: Dirk Schreckmann ]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Have you run across the Producer/Consumer example in Sun's Java Tutorial?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Parsing a variable