First, when I create a frame for my app I either have to set the size or pack
it, there is a problem for both of these things for me..if I pack it then it
is really high, and goes off the bottom on my screen, and if I set the size
directly it is hard to get it right and it may be too bug for some monitors
etc. My question.. is there any way to start up the application already
maximised. I'm using a frame as the content-hloder, with everything else in
it.
Also the same kind of question, I have the app set up with tabs, representing
the different editors in it, in one of them I have a simple text editor that
is just a textarea allowing you to view and save files, nothing else is
needed. How could I make the textarea fill all space in the tab? The
text-area are also in a tab-interface of themselves, to represent the
different files opened.
This then leads me to my last question.
What do you suggest as a way to read in the contents of the a file and put it
to the text area. At the moment I just use:
/*a method that will take the filePath as an argument and use that to create
a bufferedReader, which reads all contents into 'fileText' which is returned
to be put into a textarea*/
String readFile(String fileName)
{
BufferedReader br = null;
String fileText = null;
try{ br= new BufferedReader(new FileReader(fileName));
while((fileText = br.readLine()) != null)
{fileText += \n;
}
}
catch(...)
{...//the catch/finally ending for any errors that occur}
return fileText;
}
That's only a rough idea from memory, but that is basically what I'm doing.
Really it's just a quick hack so I could test the other areas of the
application/editors.
What way do you recommend? This way does work but I don't really think it's
the best way, as it's quite slow, and when wrapping in the textArea some of
the lines can sometimes be messed up.
Thanks in advance :)