/*
* $Id$
*
* Copyright (C) 2003-2015 JNode.org
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.jnode.awt.swingpeers;
import java.awt.AWTEvent;
import java.awt.Component;
import java.awt.peer.LightweightPeer;
import javax.swing.JComponent;
/**
* AWT lightweight component peers that does nothing.
*/
final class SwingLightweightPeer extends
SwingComponentPeer<Component, SwingLightweightComponent> implements
LightweightPeer {
public SwingLightweightPeer(SwingToolkit toolkit, Component component) {
super(toolkit, component, new SwingLightweightComponent(component));
}
}
final class SwingLightweightComponent extends JComponent implements ISwingPeer<Component> {
private static final long serialVersionUID = 1L;
private final Component awtComponent;
public SwingLightweightComponent(Component awtComponent) {
this.awtComponent = awtComponent;
}
/**
* @see org.jnode.awt.swingpeers.ISwingPeer#getAWTComponent()
*/
public Component getAWTComponent() {
return awtComponent;
}
/**
* Pass an event onto the AWT component.
*
* @see java.awt.Component#processEvent(java.awt.AWTEvent)
*/
protected final void processEvent(AWTEvent event) {
awtComponent.dispatchEvent(SwingToolkit.convertEvent(event, awtComponent));
}
/**
* Process an event within this swingpeer
*
* @param event
*/
public final void processAWTEvent(AWTEvent event) {
super.processEvent(event);
}
/**
* @see org.jnode.awt.swingpeers.ISwingPeer#validatePeerOnly()
*/
public final void validatePeerOnly() {
super.validate();
}
}