Results 1 to 5 of 5
- 02-18-2012, 06:15 AM #1
Member
- Join Date
- Feb 2012
- Posts
- 2
- Rep Power
- 0
JTextArea content is not displayed
Hi,
I tried to display some text in JTextArea. but its not displayed , but when i did System.out.println(JtextArea.getTeaxt()) the content is displayed in the output window.
Can anyone find the mistake in the code?
Here is the code...
public void scanner(File f) throws Exception
{
int worm_count=0,file_count=0,dir_count=0;
String file_name;
File[] listoffiles = f.listFiles();
String pathforworms = "C:/Documents and Settings/Srudent/My Documents/NetBeansProjects/securenet/WormList.txt";
File wormlist = new File(pathforworms);
BufferedReader br = new BufferedReader(new FileReader(wormlist));
for(int i=0;i<listoffiles.length;i++)
{
if (listoffiles[i].isFile())// for checking wether it is a file or not
{
file_count++;
file_name = listoffiles[i].toString();
//outwindow is the name of textarea
outwindow.setText(outwindow.getText()+ "\n Scanning ..... "+file_name);
Thread.sleep(100);
System.out.println(outwindow.getText());
while(br.readLine()!=null)
{
String name = br.readLine();
// System.out.println(name);
if(file_name.contains(name))// if it is a file then checking its name from
{ // the list
worm_count++;
outwindow.append("\n Worm Detected of the type"+name);
listoffiles[i].delete();
outwindow.append("\n Worm has been deleted");
}
}
}
else if(listoffiles[i].isDirectory()) // this is to check wether its a directory or not
{
dir_count++;
outwindow.append("\n Now scanning .."+listoffiles[i].getName());
scanner(listoffiles[i]);
}
}
}
Thanks
Deepsree
- 02-18-2012, 08:01 AM #2
Re: JTextArea content is not displayed
You didn't post the code that's the cause of the issue. To get better help sooner, post a SSCCE (Short, Self Contained, Compilable and Executable) example that demonstrates the problem. Not all your code.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 02-18-2012, 08:02 AM #3
Re: JTextArea content is not displayed
Two likely candidates: (1) the JTextArea you're appending to isn't the one displayed in the GUI or (2) calling sleep(...) on the EDT.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 02-18-2012, 08:30 AM #4
Member
- Join Date
- Feb 2012
- Posts
- 2
- Rep Power
- 0
Re: JTextArea content is not displayed
thanks sir...
i confirmed the control name . and i removed the sleep() also.
but still the problem exists.
outwindow.append("\n Scanning ..... "+file_name);
i gave this statement to display the contents in the textarea.
- 02-18-2012, 03:02 PM #5
Similar Threads
-
Nee help in writing the JTextarea content to a file
By ArpanSe in forum AWT / SwingReplies: 1Last Post: 09-18-2011, 05:04 PM -
mail content are not encoded as per content-transfer- encoding
By Luna Lovegood in forum New To JavaReplies: 1Last Post: 04-19-2011, 08:52 AM -
How to get the content of text file to write in JTextArea?
By realahmed8 in forum New To JavaReplies: 10Last Post: 05-24-2010, 08:25 PM -
Update content on a JTextArea.
By Masochist in forum New To JavaReplies: 7Last Post: 05-13-2010, 10:18 PM -
Jtextarea Content Display Problem
By REVANSIDDHA in forum Advanced JavaReplies: 1Last Post: 03-31-2009, 06:53 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks