small problems that seem impossible to find in the javaAPI
Hello, I have some minor problems I hoped someone here would know the answers to;
my first question is how to resize an applet, I've checked the API and found the resize(int width, int height) method, but where am I supposed to use it?
in the init? in the head? tried most places...
the second question is how to break rows when writing to a file with FileWriter, I've tried \n like in C, but it does not seem to work, and it's impossible to find any info on those kind of basic operators o_O
and lastly the third problem... I can't seem to get my program to utilize the write-to-file method I wrote, here is the relevant code;
historyWriter(historyEntryH, historyEntryT); //here's the call, and here's where I get the error
public void historyWriter(String H, String T) // and here is the method
File historyFile = new File(outputDirT.getText());
FileWriter writer = new FileWriter(historyFile, true);
writer.write(H + " / " + T + '\n' + " <|> ");
the method works fine if I call it externally, but as soon as I try to call it from the other method above I get "must be declared or thrown"
if I proceed to change the above code to
I can proceed and compile the program, but it doesnt work (it wont write to the file in question, and the for-loop the call is in stops working properly)
it's probably a simple mistake, does anyone have any good ideas? ^_^
It's been a while but I think you use the setSize method in init.
when I write text to a file I'll use a PrintWriter. It makes it super easy to write a line break.
PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(targetFile)));
Also if your writing to a file from an applet you could run into problems because of the security setup for applets. You can read from files in an applet though.
Last edited by Joe Beam; 12-12-2005 at 01:23 PM.
By Beginner in forum .NET
Last Post: 01-27-2002, 05:35 PM
By Karl Robinson in forum VB Classic
Last Post: 07-23-2001, 10:58 AM
By bigbastard4 in forum Database
Last Post: 05-16-2001, 06:24 PM
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center