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
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?
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.
Joined: Apr 25, 2013
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.