Hi there,
I have got this problem which is rather puzzling, to me at least.
My team-mate and I each did our coding and they work as standalone. His part is the UI and mine the backend processing.
He did his code using BlueJ using JDK 1.3, I did mine in JCreator using JDK 1.4.2_8. (I know its bad to not use the same version... :o but please read on.)
Apparently when compiling his code using BlueJ on my pc (WinXP), there were some compilation errors, and I fixed them. (Most prob due to different JDK versions. The error was in his type casting.) Compiled them again as standalone on my pc and they worked fine once more when i run them.
Now I tried to run his applet code with my code integrated, through BlueJ, by just integrating one simple function as a test. The applet opens and loads up. All the UI appears. Tried the function but cannot work. :eek:
Next I tried using JCreator to compile his code with mine, it compiled fine. Then I created a html file with the <applet> tags. It opens up the applet as before with all the UI buttons loaded but the integrated function cannot work. :eek:
Next I used the commands at command prompt:appletviewer sample.htm
The applet opens up and works fine. The integrated command is working. :!:
The integrated command is opening a textfile and retrieve and store its contents into an arraylist. Upon user clicking a button on the UI, it would seek out the a particular cell of contents in the arraylist.
I did some debugging for the failed scenarios and discovered that my code could not find my myTextFile.txt file when it exists on the same directory. Tried to convert file type from unix to windows, still have the same problem. :cry:
Could someone please enlighten me on how to go about solving this problem please...
Very sincerely,
Rackus
Code:
UI Snipplet:
========
public class UIFILE extends JApplet implements MouseListener, ActionListener, ItemListener
{ .... ... //declaration of global variables
private TextArea TA = new TextArea (5,10);
myClassFile cs = new myClassFile;
... ... ...
public void actionPerformed ( ActionEvent e ) {
Object source = e.getSource();
... ...
if (source == getContent ) {
TA.append("Contents: "+cs.retrieveDetails("XXX"));
}
... ...
}
... ... ...
}
BackEndProcessing Snipplet:
=====================
pulic class myClassFile {
.....
//declaration of my global variables
readFile rf = new readFile();
..... ....
public myClassFile()
{
rf.openNstore(); //opens the txt file and stores it into an array list. as standalone it works.
}
... ...
public String retrieveDetails( String toCheckAgainst )
{
String result = rf.getValue(toCheckAgainst); //it gets the value. works as standalone.
return result;
}
... .... ...
}