Newbie on JtextArea swing component
- From: richard.copeman@xxxxxxxxxxxxxxxx
- Date: Tue, 31 Jul 2007 09:02:58 -0700
Hi,
Probably a very basic question but I can't find any useful pointers.
If someone can point me in the right direction please...?
I am using Netbeans 5.5 and have a JTextarea inside a JScrollPane. I
am reading a file and adding the lines one at a time to the JTextare
with the following code:
try
{
FileInputStream fstream = new
FileInputStream(SrcFile);
DataInputStream in = new
DataInputStream(fstream);
// Continue to read lines while
// there are still some left to read
jT_SourceCode.setText(in.readLine()+"\n");
while (in.available() !=0)
{
jT_SourceCode.append(in.readLine()+"\n");
}
in.close();
}
and this works very nicely. I can see the contents of my file in the
textarea object. I want to be able to set an arbitrary line as the top
visible line in the GUI and have the line highlighted.
Can somebody point me at a tutorial or example for this please?
TIA,
Richard.
.
- Follow-Ups:
- Re: Newbie on JtextArea swing component
- From: Roedy Green
- Re: Newbie on JtextArea swing component
- Prev by Date: Re: XMPP Java bot loop question
- Next by Date: Re: Newbie on JtextArea swing component
- Previous by thread: XMPP Java bot loop question
- Next by thread: Re: Newbie on JtextArea swing component
- Index(es):