hi all

i have 2 files one of which is a gui, the other a java file. I need to take my gui input and put it through the java file. How do i do that? I've tried calling the classes but the input just doesnt seem to be going through.

Any recommendations?

Recommended Answers

All 8 Replies

take the GUI input in the actionPerformed method. create an object of your other class and pass the GUI input value as a parameter to the objects constructor.

Did you try any of the suggestions from the last time you posted this query?

I have 3 instances here under the actionperformed..

QuerySeq convertQuery = new QuerySeq();
	convertQuery.QuerySeq(fileQuery);
					    
	TargetSeq convertTarget = new TargetSeq();
        convertTarget.TargetSeq(fileTarget);
					 
	String fileTarget1 = "C:\\Users\\Royston\\Desktop\\final\\Target & Query\\Targetseq.txt";
	String fileQuery1 = "C:\\Users\\Royston\\Desktop\\final\\Target & Query\\Queryseq.txt";
			   
    	 MatchApplet DPTest = new MatchApplet();
    	DPTest.init(fileTarget1, fileQuery1);

QuerySeq() and TargetSeq() are giving out a file each containing a sequence MatchApplet is suppsoed to read the sequence from both files and do certain something and also output to a file. Currently my Matchapplet() gave out a file that is empty. But MatchApplet is definitely working. do you know what roughly went wrong?

hi jon, yeap i did, im able to run it alone but when i added in more things like the code i just gave above..the file output that i got was empty now..

Well, this is some awful code you're putting up here. Is QuerySeq a class( QuerySeq convertQuery = new QuerySeq();) or a method( convertQuery.QuerySeq(fileQuery); )? If both, that's a problem - not for the compiler, but for anyone trying to read the code.


Also, please be precise in describing the problem and describing your code.
You keep saying that the output from this or that is a "file" - is that what you mean? If so, and you're running as an applet, you might be seeing trouble due to the applet filesystem restrictions. Last time, "file" meant "String", though, so I don't know.

You also say that you have "a GUI and a java file" - this is totally meaningless, especially since your previous post had GUI code in both java source files.

yeah i actually remember answering this thread sometime back in another thread. anyway, i know why your code looks so awful- when i said pass the parameter to the constructor, i meant

QuerySeq convertQuery = new QuerySeq(param);

NOT what you're doing, which is poor coding style

QuerySeq convertQuery = new QuerySeq();
convertQuery.QuerySeq(param);

hi all

sorry for the late reply, I've tried using, QuerySeq convertQuery = new QuerySeq(param); but there's error.

just to further explain my problem.

QuerySeq convertQuery = new QuerySeq();
convertQuery.QuerySeq(fileQuery);
					    
TargetSeq convertTarget = new TargetSeq();
 convertTarget.TargetSeq(fileTarget);
    				
 MatchApplet DPTest = new MatchApplet();
DPTest.init();

Targetseq & Queryseq are to read the read the files selected from the GUI and extract the sequence and print them out into a new file in this case 2 files are created(QuerySeq.txt & TargetSeq.txt). Then, MatchApplet() is an algorithm which is supposed to read the 2 newly created files and calculate their global and local alignment, then print the new output into a new file (DynProResult.txt).

However , what is happening now is that, MatchApplet doesnt seem to be reading the 2 txt files(QuerySeq.txt & TargetSeq.txt). And the DynProResult.txt created by MatchApplet() is empty inside. I do not know what went wrong because all 3 are working fine when ran alone. So Sorry, just wanted to get it working first before i improve on the codes.

Btw fileQuery and fileTarget are the files that are selected by the user in GUI

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.