Skip to main content

persistent text-display dialog box (or frame?)

Please note these forums are being decommissioned and use the new and improved forums at
1 reply [Last post]
Joined: 2012-06-09


I need to make a scrolling, minimizable text-display dialog box that the main program can write to, and I need it to stay on screen (unless minimized) throughout the life of the application run.

Can anybody point me in the right direction? Unless I missed something, the tutorial examples seem not to include this particular variant.



Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2007-11-14

There are several ways to do it but I suggest the following.
Create a JFrame on a new thread, so it has a run method containing a loop which runs in parallel to the main program. Get the graphics context (java.awt.Graphics2D) of the content pane of the frame and use it to write the text using using gc.drawString, so you can position it at known x, y coordinates. In the thread's run loop redraw the text at regular intervals with a change in the x position each time.