net.fenyo.gnetwatch.GUI
Class AwtGUI

java.lang.Object
  extended by net.fenyo.gnetwatch.GUI.AwtGUI
All Implemented Interfaces:
java.lang.Runnable

public class AwtGUI
extends java.lang.Object
implements java.lang.Runnable

This class creates JFrame instances outside of SWT, to allow use of Java2D API.

Version:
$Id: AwtGUI.java,v 1.15 2008/04/26 22:38:34 fenyo Exp $
Author:
Alexandre Fenyo

Field Summary
private  Config config
           
private  java.util.List<javax.swing.JFrame> frame_list
           
private static Log log
           
private  java.lang.Thread repaint_thread
           
 
Constructor Summary
AwtGUI(Config config)
          Constructor.
 
Method Summary
private  void _createFrame(javax.swing.JFrame frame, BasicComponent component)
          Adds a component to a frame and displays the frame.
 void createAwtGUI()
          Creates a thread that will repaint each frame regularly.
 javax.swing.JFrame createFrame(java.lang.String name, BasicComponent component)
          Adds a component to a frame and displays the frame.
private  void createRepaintThread()
          Creates a thread that will repaint each frame regularly.
 void dropFrame(javax.swing.JFrame frame)
          Removes an AWT frame.
 void end()
          Terminates the repaint thread and closes any frame.
 void run()
          Refreshes the frames regularly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static Log log

config

private final Config config

repaint_thread

private java.lang.Thread repaint_thread

frame_list

private java.util.List<javax.swing.JFrame> frame_list
Constructor Detail

AwtGUI

public AwtGUI(Config config)
Constructor.

Parameters:
config - configuration.
Method Detail

dropFrame

public void dropFrame(javax.swing.JFrame frame)
Removes an AWT frame.

Parameters:
frame - frame to remove.

createAwtGUI

public void createAwtGUI()
Creates a thread that will repaint each frame regularly.

Parameters:
none. -

createRepaintThread

private void createRepaintThread()
Creates a thread that will repaint each frame regularly.

Parameters:
none. -

_createFrame

private void _createFrame(javax.swing.JFrame frame,
                          BasicComponent component)
Adds a component to a frame and displays the frame. This method must be run from the AWT thread.

Parameters:
frame - frame.
component - component to add.

createFrame

public javax.swing.JFrame createFrame(java.lang.String name,
                                      BasicComponent component)
                               throws java.lang.InterruptedException,
                                      java.lang.reflect.InvocationTargetException
Adds a component to a frame and displays the frame. This method can be run from any thread, and particularly the SWT thread.

Parameters:
frame - frame.
component - component to add.
Throws:
java.lang.InterruptedException
java.lang.reflect.InvocationTargetException

run

public void run()
Refreshes the frames regularly.

Specified by:
run in interface java.lang.Runnable
Parameters:
none. -

end

public void end()
         throws java.lang.InterruptedException
Terminates the repaint thread and closes any frame.

Parameters:
none. -
Throws:
java.lang.InterruptedException - exception.