*
The moose likes Java in General and the fly likes Making a fake console that constantly updates and redirects system.out Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Making a fake console that constantly updates and redirects system.out" Watch "Making a fake console that constantly updates and redirects system.out" New topic
Author

Making a fake console that constantly updates and redirects system.out

Ollie Relent
Greenhorn

Joined: Apr 25, 2013
Posts: 11
Hey guys,

So i've essentially got a GUI step up with cardlayout and gridbaglayout. I'm drawing in information from hardware, processing it and performing corresponding actions based on the data. However all my outputs are currently displayed in the console.

To get my GUI panels changing correctly whilst other methods were working I've had to use the swingutilities.invokelater method. I have a object inside an invoke later that reads in data and has many system.out.printlns in

I made a fake console using http://stackoverflow.com/questions/342990/create-java-console-inside-the-panel

However, it does not update dynamically. One of my methods is essentially an infinite loop which looks for certain data and displays outputs based on the value of the data. The normal console updates correctly with this but the JTextArea seems to only update when a method is finished.

Could someone show/explain how to make it run in real time?

Thanks

Ben Ooms
Ranch Hand

Joined: May 16, 2011
Posts: 44

Hi Ollie,

Don't know exactly what you want to achieve but it looks like you want to process something in the background and update swing components when the background task executes. Did you have a look at Swingworker, might suit your needs. I recently did something with it when updating a view with a connected Arduino on the USB port. https://bitbucket.org/bendh/jenkinstoarduino . Look at the MainFrame class and it's inner class StatusUpdateTask.

regards,
Ben
Ollie Relent
Greenhorn

Joined: Apr 25, 2013
Posts: 11
Yes, essentially i have a method which streams from hardware and prints the values of arrays to the console. As a .jar does not have the console as eclipse does, i need a way of showing the output real time within the jframe.

Therefore, this is why I wanted to get it running real time. I tried updating the GUI with swing worker but it still doesnt do it realtime, it does it at the end of my streaming data method which is not what i want.

Any ideas?

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Making a fake console that constantly updates and redirects system.out
 
Similar Threads
Problem with csv file
Creating a command prompt is swing
Problem Updating JTable
Using Flyweight with Panels
Still having some trouble with Observer/Observable