aspose file tools*
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to ceate a console window...
 
Similar Threads
Printinting problem in Swing (not taking new line)
Graphics
How to catch number errors?
printing multiple line string
Text in different colours