Index: trunk/src/org/expeditee/items/widgets/JavaFXWidget.java
===================================================================
--- trunk/src/org/expeditee/items/widgets/JavaFXWidget.java	(revision 1176)
+++ trunk/src/org/expeditee/items/widgets/JavaFXWidget.java	(revision 1177)
@@ -2,8 +2,11 @@
 
 import org.expeditee.core.Image;
+import org.expeditee.core.bounds.AxisAlignedBoxBounds;
 import org.expeditee.gio.EcosystemManager;
 import org.expeditee.gio.EcosystemManager.Ecosystem;
 import org.expeditee.gio.javafx.JavaFXMiscManager;
+import org.expeditee.items.ItemParentStateChangedEvent;
 import org.expeditee.items.Text;
+import org.expeditee.items.UserAppliedPermission;
 
 import javafx.scene.Group;
@@ -14,10 +17,9 @@
 
 public abstract class JavaFXWidget extends Widget {
-	
+
 	protected Scene _dummyScene;
 	protected Node _node;
 
-	protected JavaFXWidget(Text source, Node jfxNode, int minWidth, int maxWidth, int minHeight, int maxHeight)
-	{
+	protected JavaFXWidget(Text source, Node jfxNode, int minWidth, int maxWidth, int minHeight, int maxHeight) {
 		super(source, minWidth, maxWidth, minHeight, maxHeight);
 		_node = jfxNode;
@@ -27,12 +29,50 @@
 	
 	@Override
-	public boolean isSupportedOnEcosystem(Ecosystem type)
-	{
+	protected void addWidgetContent(final ItemParentStateChangedEvent e) {
+		if ((e.getEventType() == ItemParentStateChangedEvent.EVENT_TYPE_ADDED_VIA_OVERLAY || e
+				.getEventType() == ItemParentStateChangedEvent.EVENT_TYPE_SHOWN_VIA_OVERLAY)
+				&& e.getOverlayLevel().equals(UserAppliedPermission.none)) {
+			return; // item belongs to a non-active overlay
+		}
+		
+		//TODO: Add code here that attaches JavaFX content to the widget.  This was added by Bryce
+		//as it was necessary for Swing widgets functionality.
+	}
+	
+	@Override
+	protected void addKeyListenerToWidget() {
+		// TODO: Add code here that attaches JavaFX key listeners 
+		
+	}
+	
+	@Override
+	protected void addThisAsContainerListenerToContent() {
+		// TODO: Add code here that attaches the equiv of swings Content Listener
+		
+	}
+	
+	@Override
+	public AxisAlignedBoxBounds getContentBounds() {
+		// TODO: Return the bounds of the content that is being drawn.  Potentially different from the bounds of the widget.
+		return null;
+	}
+	
+	@Override
+	protected void layout() {
+		// TODO: Respond to layout
+	}
+	
+	@Override
+	protected void onBoundsChanged() {
+		// TODO: Respond to widget bounds changing.	
+	}
+
+	@Override
+	public boolean isSupportedOnEcosystem(Ecosystem type) {
 		return type == Ecosystem.JavaFX;
 	}
 
 	@Override
-	public void paintWidget()
-	{
+	public void paintWidget() {
 		SnapshotParameters params = new SnapshotParameters();
 		WritableImage snapshot = _node.snapshot(params, null);
@@ -40,14 +80,12 @@
 		EcosystemManager.getGraphicsManager().drawImage(image, getPosition());
 	}
-	
+
 	@Override
-	protected void onMoved()
-	{
+	protected void onMoved() {
 		// Do nothing
 	}
-	
+
 	@Override
-	protected void onSizeChanged()
-	{
+	protected void onSizeChanged() {
 		_dummyScene.getRoot().resize(getWidth(), getHeight());
 		_node.resize(getWidth(), getHeight());
Index: trunk/src/org/expeditee/items/widgets/SwingWidget.java
===================================================================
--- trunk/src/org/expeditee/items/widgets/SwingWidget.java	(revision 1176)
+++ trunk/src/org/expeditee/items/widgets/SwingWidget.java	(revision 1177)
@@ -5,12 +5,28 @@
 import java.awt.Graphics2D;
 import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.event.ContainerEvent;
+import java.awt.event.ContainerListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
 
 import javax.swing.JComponent;
-
+import javax.swing.JPopupMenu;
+
+import org.expeditee.core.bounds.AxisAlignedBoxBounds;
+import org.expeditee.gio.EcosystemManager;
 import org.expeditee.gio.EcosystemManager.Ecosystem;
+import org.expeditee.gio.swing.SwingGraphicsManager;
+import org.expeditee.gio.swing.SwingInputManager;
 import org.expeditee.gio.swing.SwingMiscManager;
+import org.expeditee.gui.DisplayController;
+import org.expeditee.items.ItemParentStateChangedEvent;
 import org.expeditee.items.Text;
-
-public abstract class SwingWidget extends Widget
+import org.expeditee.items.UserAppliedPermission;
+
+public abstract class SwingWidget extends Widget implements ContainerListener, KeyListener
 {
 	// A flag for signifying whether the swing components are ready to paint.
@@ -22,13 +38,20 @@
 
 	protected JComponent _swingComponent;
-	
+		
 	protected SwingWidget(Text source, JComponent component, int minWidth, int maxWidth, int minHeight, int maxHeight)
 	{
 		super(source, minWidth, maxWidth, minHeight, maxHeight);
 
-		if (component == null) throw new NullPointerException("component");
-
+		if (component == null) {
+			throw new NullPointerException("component");
+		}
+				
 		_swingComponent = component;
+		_swingComponent.setFocusable(true);
+		addKeyListenerToWidget();
+		addThisAsContainerListenerToContent();
 		onBoundsChanged();
+		
+		JPopupMenu.setDefaultLightWeightPopupEnabled(false);
 	}
 
@@ -36,4 +59,117 @@
 	{
 		return _swingComponent;
+	}
+	
+	@Override
+    public void keyTyped(KeyEvent e) {
+		
+		int keyCode = e.getKeyCode();
+    	
+    	if (keyCode >= KeyEvent.VK_F1 && keyCode <= KeyEvent.VK_F12) {
+    		((SwingInputManager) EcosystemManager.getInputManager()).keyTyped(e);
+    	}
+    }
+
+	@Override
+    public void keyPressed(KeyEvent e) {
+    	int keyCode = e.getKeyCode();
+    	    	
+    	if (keyCode >= KeyEvent.VK_F1 && keyCode <= KeyEvent.VK_F12) {
+    		((SwingInputManager) EcosystemManager.getInputManager()).keyTyped(e);
+    	}
+    }
+    
+	@Override
+    public void keyReleased(KeyEvent e) {
+		int keyCode = e.getKeyCode();
+    	
+    	if (keyCode >= KeyEvent.VK_F1 && keyCode <= KeyEvent.VK_F12) {
+    		((SwingInputManager) EcosystemManager.getInputManager()).keyTyped(e);
+    	}
+    }
+	
+	/**
+	 * Makes sure we add our KeyListener to every child component,
+	 * since it seems that's the only way to make sure we capture key events in Java
+	 * (without using KeyBindings which seem to only support the keyTyped event)
+	 */
+	@Override
+	public void componentAdded(ContainerEvent e) {
+		if(e == null || e.getChild() == null) {
+			return;
+		}
+		keyListenerToChildren(e.getChild(), true);
+	}
+	
+	@Override
+	public void componentRemoved(ContainerEvent e) {
+		if(e == null || e.getChild() == null) {
+			return;
+		}
+		keyListenerToChildren(e.getChild(), false);
+	}
+	
+	@Override
+	protected void addWidgetContent(final ItemParentStateChangedEvent e) {
+		if ((e.getEventType() == ItemParentStateChangedEvent.EVENT_TYPE_ADDED_VIA_OVERLAY || e
+				.getEventType() == ItemParentStateChangedEvent.EVENT_TYPE_SHOWN_VIA_OVERLAY)
+				&& e.getOverlayLevel().equals(UserAppliedPermission.none)) {
+			return; // item belongs to a non-active overlay
+		}
+		
+		if(_swingComponent.getParent() == null) {
+			if (e.getEventType() == ItemParentStateChangedEvent.EVENT_TYPE_SHOWN
+					|| e.getEventType() == ItemParentStateChangedEvent.EVENT_TYPE_SHOWN_VIA_OVERLAY
+					|| e.getSource() == DisplayController.getCurrentFrame()) {
+				onBoundsChanged();
+				((SwingGraphicsManager) EcosystemManager.getGraphicsManager()).getContentPane().add(_swingComponent);
+				layout(_swingComponent);
+			}
+		}
+	}
+	
+	@Override
+	protected void addKeyListenerToWidget() {
+		keyListenerToChildren(_swingComponent, true);
+	}
+	
+	@Override
+	protected void addThisAsContainerListenerToContent() {
+		_swingComponent.addContainerListener(this);
+	}
+	
+	@Override
+	public AxisAlignedBoxBounds getContentBounds() {
+		//final Rectangle bounds = _swingComponent.getBounds();
+		//final AccessibleContext accessibleContext = _swingComponent.getAccessibleContext();
+		//if (accessibleContext != null) {
+		//	final Rectangle accessibleBounds = _swingComponent.getAccessibleContext().getAccessibleComponent().getBounds();
+		//	return new AxisAlignedBoxBounds(bounds.x, bounds.y, bounds.width, bounds.height + accessibleBounds.height);
+		//} else {
+		//	return new AxisAlignedBoxBounds(bounds.x, bounds.y, bounds.width, bounds.height);
+		//}		
+		final Rectangle bounds = _swingComponent.getBounds();
+		return new AxisAlignedBoxBounds(bounds.x, bounds.y, bounds.width, bounds.height);
+	}
+	
+	@Override
+	protected void layout() {
+		layout(_swingComponent);
+	}
+	
+	private void keyListenerToChildren(Component parent, boolean add) {
+		List<Component> components = new LinkedList<Component>();
+		components.add(parent);
+		while(!components.isEmpty()) {
+			Component c = components.remove(0);
+			if(c instanceof Container) {
+				components.addAll(Arrays.asList(((Container)c).getComponents()));
+			}
+			if(add && !Arrays.asList(c.getKeyListeners()).contains(this)) {
+				c.addKeyListener(this);
+			} else if (!add && Arrays.asList(c.getKeyListeners()).contains(this)) {
+				c.removeKeyListener(this);
+        	}
+		}
 	}
 	
@@ -51,7 +187,10 @@
 	}
 
+	@Override
 	public final void onBoundsChanged()
 	{
-		if (_swingComponent == null) return;
+		if (_swingComponent == null) {
+			return;
+		}
 		
 		if (isFixedSize()) {
@@ -71,12 +210,23 @@
 	private void ignoreAWTPainting(Component c)
 	{
-		if (c == null) return;
-		
-		if (c instanceof JComponent) ((JComponent) c).setDoubleBuffered(false);
+		if (c == null) {
+			return;
+		}
+		
+		if (c instanceof JComponent) {
+			((JComponent) c).setDoubleBuffered(false);
+		}
 		c.setIgnoreRepaint(true);
-
+		
 		if (c instanceof Container) {
 			for (Component child : ((Container) c).getComponents()) {
-				ignoreAWTPainting(child);
+				if(child instanceof Container) {
+					ignoreAWTPainting(child);
+				} else {
+					if(child instanceof JComponent) {
+						((JComponent) child).setDoubleBuffered(false);
+					}
+					child.setIgnoreRepaint(true);
+				}
 			}
 		}
@@ -88,7 +238,9 @@
 	 * @param parent
 	 */
-	protected void layout(Component parent)
-	{
-		if (parent == null) return;
+	private void layout(Component parent)
+	{
+		if (parent == null) {
+			return;
+		}
 		
 		parent.validate();
@@ -98,5 +250,5 @@
 				layout(child);
 			}
-		}
+		} 
 	}
 
@@ -116,4 +268,7 @@
 	protected void paintSwingWidget(Graphics2D g)
 	{
+//		final GraphicsManager gm = SwingGraphicsManager.getInstance();
+//		final EnforcedClipKey clipKey = gm.pushClip(new Clip(getContentBounds()));
+				
 		final Point location = _swingComponent.getLocation();
 		int x = location.x;
@@ -122,4 +277,6 @@
 		_swingComponent.paint(g);
 		g.translate(-x, -y);
+		
+//		gm.popClip(clipKey);
 	}
 	
Index: trunk/src/org/expeditee/items/widgets/Widget.java
===================================================================
--- trunk/src/org/expeditee/items/widgets/Widget.java	(revision 1176)
+++ trunk/src/org/expeditee/items/widgets/Widget.java	(revision 1177)
@@ -542,4 +542,7 @@
 		}
 		
+		//addThisAsContainerListenerToContent();
+		//addKeyListenerToWidget();
+		
 		_textRepresentation = source;
 
@@ -1113,13 +1116,50 @@
 			case ItemParentStateChangedEvent.EVENT_TYPE_SHOWN_VIA_OVERLAY:
 				EcosystemManager.addInteractiveWidget(this);
+				addWidgetContent(e);
 				break;
 		}
 
-		DisplayController.invalidateItem(_d1, getBounds());
+		DisplayController.invalidateItem(_d1, getContentBounds());
 
 		// Forward filtered event to upper classes...
 		onParentStateChanged(e.getEventType());
 	}
-
+	
+	/**
+	 * Subclassing Widgets overwrite to add their specific content to the Frame.
+	 * For example, a widget being Java Swing must add their Swing component to Expeditee's content pane.
+	 * @param e Can be used to identify if it is appropriate to draw the widget. 
+	 */
+	abstract protected void addWidgetContent(final ItemParentStateChangedEvent e);
+	
+	/**
+	 * Subclassing Widgets overwrite to specify their own functionality as to how key events
+	 * are to be forwarded to Expeditee.
+	 */
+	abstract protected void addKeyListenerToWidget();
+	
+	/**
+	 * Subclassing widgets overwrite to specify how content will respond to being added and removed.
+	 */
+	abstract protected void addThisAsContainerListenerToContent();
+	
+	/**
+	 * Subclassing widgets overwrite to provide the size and position of their content.
+	 * For example, a widget using Java Swing might return _swingComponent.getBounds().
+	 * @return The bounds of the content that is being drawn.
+	 */
+	abstract public AxisAlignedBoxBounds getContentBounds();
+	
+	/**
+	 * Due to absolute positioning...
+	 * @param parent
+	 */
+	abstract protected void layout();
+	
+	/**
+	 * Subclassing widgets overwrite  to respond to changes in widget bounds.
+	 */
+	abstract protected void onBoundsChanged();
+	
 	/**
 	 * Override to make use of. Internally this is reported once by all corners,
@@ -1154,5 +1194,6 @@
 	public AxisAlignedBoxBounds getBounds()
 	{
-		return new AxisAlignedBoxBounds(getX(), getY(), getWidth(), getHeight());
+		return getContentBounds();
+		//return new AxisAlignedBoxBounds(getX(), getY(), getWidth(), getHeight());
 	}
 
@@ -1882,6 +1923,12 @@
 	public Clip getClip()
 	{
-		final Clip clip = new Clip(getBounds());
+		final Clip clip = new Clip(getContentBounds());
 		return clip;
 	}
+	
+	public void onResized() {
+		invalidateSelf();
+		onBoundsChanged();
+		layout();
+	}
 }
Index: trunk/src/org/expeditee/items/widgets/WidgetCorner.java
===================================================================
--- trunk/src/org/expeditee/items/widgets/WidgetCorner.java	(revision 1176)
+++ trunk/src/org/expeditee/items/widgets/WidgetCorner.java	(revision 1177)
@@ -23,4 +23,5 @@
 import org.expeditee.core.Colour;
 import org.expeditee.core.Point;
+import org.expeditee.core.bounds.Bounds;
 import org.expeditee.core.bounds.PolygonBounds;
 import org.expeditee.items.Dot;
@@ -35,7 +36,17 @@
 		super(x, y, id);
 
-		if (widgetSource == null)
+		if (widgetSource == null) {
 			throw new NullPointerException("widgetSource");
+		}
 		_widgetSource = widgetSource;
+	}
+	
+	@Override
+	public Bounds updateBounds() {
+		final Bounds ret = super.updateBounds();
+		if (_widgetSource != null) {
+			_widgetSource.onBoundsChanged();
+		}
+		return ret;
 	}
 
@@ -246,5 +257,5 @@
 	public boolean contains(Point p)
 	{
-		return super.contains(p) && !_widgetSource.getBounds().contains(p);
+		return super.contains(p) && !_widgetSource.getContentBounds().contains(p);
 	}
 
@@ -253,6 +264,7 @@
 		if (_widgetSource != null) {
 			float minThickness = _widgetSource.getMinimumBorderThickness();
-			if (newThickness < minThickness)
+			if (newThickness < minThickness) {
 				newThickness = minThickness;
+			}
 			super.setThickness(newThickness, setConnected);
 			_widgetSource.setSourceThickness(newThickness, false);
