Meaningless Drivel is fun!
The moose likes Swing / AWT / SWT and the fly likes Logging Tab Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Logging Tab" Watch "Logging Tab" New topic

Logging Tab

Patrick Brahami
Ranch Hand

Joined: Oct 12, 2008
Posts: 32
Alright I have finally finished my application business logic and GUI(Swing if it matters).
(a lot thanks to you Java Ranch community!!)

I want to create a new tab that only I (the program) will be able to write to, and it will be just a white text field with messages. And I'll even let the user ability to save it as text file.

Again, I've got naive solutions in my head. But I prefer to advice before
starting so the idea is - how is it done?
Should I work with a label? a big text box?
How can I write line at a time? and is there a limit on the size of lines that can be written to a textbox?

Thanks in advance.
[ October 19, 2008: Message edited by: Patrick Brahami ]
Pavan Kumar Srinivasan

Joined: Sep 17, 2008
Posts: 27
For multiple lines use a JTextArea and set editable to false for other users.
Patrick Brahami
Ranch Hand

Joined: Oct 12, 2008
Posts: 32
I see. Fits nice.
How can I append text in different color/font size?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10825

Check out JTextPane and StyledDocument.
You can find some examples here:

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
I agree. Here's the link:
subject: Logging Tab
It's not a secret anymore!