File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Which Swing Component to Use to view log file ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Which Swing Component to Use to view log file ??" Watch "Which Swing Component to Use to view log file ??" New topic

Which Swing Component to Use to view log file ??

Craig Williams

Joined: Apr 26, 2004
Posts: 9
Hello Everybody

I want to view the log file in Unix OS.Normally we use tail command to view
the log file contents dyanmically (as the log file changes, it shows the latest change to that log file).
Basically i want to simulate the same thing with Swing component.
Kindly let me know which component i can use.. more like editor where i would give the file to be viewed..It should be dynamically show me the content of the log file.

Shed some light on this.I would really appreciate
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41104
Maybe JList. You could either use its setListData method to give it a list of the messages to display, or work explicitly with a ListModel via the setModel method.

Ping & DNS - my free Android networking tools app
Darrin Cartwright
Ranch Hand

Joined: Dec 27, 2002
Posts: 107
Hi Craig!

I used a JTextArea with editable set to false. As each line is read from the file you just need to call JTextArea.append(theLine);

Hope that helps!


Life is good on the Ponderosa,<br />but mind where you step.
I agree. Here's the link:
subject: Which Swing Component to Use to view log file ??
Similar Threads
Tree Component
Reading Dynamically Changing Files
Yes! I made it! Part II 93% - Thanks to the forum!
Problems with JSplitPane
swt + jface == swing ?