Example usage for java.awt Frame repaint

List of usage examples for java.awt Frame repaint

Introduction

In this page you can find the example usage for java.awt Frame repaint.

Prototype

public void repaint() 

Source Link

Document

Repaints this component.

Usage

From source file:net.fenyo.gnetwatch.GUI.AwtGUI.java

/**
 * Refreshes the frames regularly./* w w w.  j  a  v  a2 s.  c  o  m*/
 * @param none.
 * @return void.
 */
// repaint thread
public void run() {
    int cnt = 0;
    while (!config.isEnd())
        try {
            Thread.sleep(20);
            cnt++;
            synchronized (frame_list) {
                for (final Frame frame : frame_list) {
                    final BasicComponent component = ((BasicComponent) ((JFrame) frame).getContentPane()
                            .getComponent(0));
                    if ((component.isManualMode() == false && component.pixelsOffsetChanged() == true)
                            || cnt == 50)
                        frame.repaint();
                }
            }
            if (cnt == 50)
                cnt = 0;
        } catch (final InterruptedException ex) {
            // this thread is interrupted when the application is terminated
        }
}