For debug purposes, I need to draw image on the screen in a simple window.
Swing handles all it\'s events in a separate message loop thread. That means that if I do
Build your GUI outside the loop once and then use
// read new component data screenshot = MSWindow.screenshot(); // modify components label = new JLabel(new ImageIcon(screenshot)); // force the frame to repaint its chilfren frame.revalidate(); frame.pack();
to "refresh" it inside the loop.