GeeCON Prague 2014*
The moose likes Swing / AWT / SWT and the fly likes How to ceate a console window... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to ceate a console window..." Watch "How to ceate a console window..." New topic
Author

How to ceate a console window...

Juhan Voolaid
Ranch Hand

Joined: Nov 18, 2003
Posts: 179
Hi
I want to create a console winddow (panel) to my program. It is just a small panel where some kind of info is displayed like in console when u System.out.println() something. At first i thought that i make a JPanel and fill it with black colour and drawString() the text i want there to be displayed. But my problem is:
If string="one line \n and another line"
when i drawString(string); the text appear on single line.

How could i make new line in drawString() function?
Or what other ways should i use in this situation? And ofcourse is there a way to put (real)console inside a panel?
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

real console: No. will not work.
drawString allways writes a single line and needs coordinates, as far as I know, which may lead to complex calculations.
What's about using a JTextArea?


http://home.arcor.de/hirnstrom/bewerbung
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to ceate a console window...