• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to ceate a console window...

 
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
reply
    Bookmark Topic Watch Topic
  • New Topic