本文整理汇总了Java中org.netbeans.api.visual.action.WidgetAction.WidgetKeyEvent类的典型用法代码示例。如果您正苦于以下问题:Java WidgetKeyEvent类的具体用法?Java WidgetKeyEvent怎么用?Java WidgetKeyEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WidgetKeyEvent类属于org.netbeans.api.visual.action.WidgetAction包,在下文中一共展示了WidgetKeyEvent类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: keyTyped
import org.netbeans.api.visual.action.WidgetAction.WidgetKeyEvent; //导入依赖的package包/类
public State keyTyped(Widget widget, WidgetKeyEvent event) {
if (widget instanceof IEdgeWidget && event.getKeyChar() == KeyEvent.VK_DELETE) {
GraphPinScene scene = (GraphPinScene) widget.getScene();
if (widget instanceof IEdgeWidget) {
((IEdgeWidget) widget).remove(true);
return State.CONSUMED;
}
}
return State.REJECTED;
}
示例2: keyTyped
import org.netbeans.api.visual.action.WidgetAction.WidgetKeyEvent; //导入依赖的package包/类
public State keyTyped (Widget widget, WidgetKeyEvent event) {
if (! aiming && event.getKeyChar () == KeyEvent.VK_SPACE) {
provider.select (widget, null, (event.getModifiersEx () & MouseEvent.CTRL_DOWN_MASK) != 0);
return State.CONSUMED;
}
return State.REJECTED;
}
示例3: keyTyped
import org.netbeans.api.visual.action.WidgetAction.WidgetKeyEvent; //导入依赖的package包/类
@Override
public State keyTyped(Widget widget, WidgetKeyEvent event) {
return innerAction.keyTyped(widget, event);
}
示例4: keyPressed
import org.netbeans.api.visual.action.WidgetAction.WidgetKeyEvent; //导入依赖的package包/类
@Override
public State keyPressed(Widget widget, WidgetKeyEvent event) {
if (!event.isControlDown())
{
if (event.getKeyCode() == KeyEvent.VK_LEFT ||
event.getKeyCode() == KeyEvent.VK_RIGHT ||
event.getKeyCode() == KeyEvent.VK_UP ||
event.getKeyCode() == KeyEvent.VK_DOWN)
{
int len = (event.isShiftDown()) ? 10 : 1;
Point delta = new Point(0,0);
switch (event.getKeyCode())
{
case KeyEvent.VK_LEFT: delta.x -= len; break;
case KeyEvent.VK_RIGHT: delta.x = len; break;
case KeyEvent.VK_UP: delta.y -= len; break;
case KeyEvent.VK_DOWN: delta.y = len; break;
}
List<JRDesignElementWidget> widgets = new ArrayList<JRDesignElementWidget>();
AbstractReportObjectScene scene = (AbstractReportObjectScene)widget.getScene();
Iterator iterSelectedObject = scene.getSelectedObjects().iterator();
while (iterSelectedObject.hasNext())
{
Object obj = iterSelectedObject.next();
Widget w = scene.findWidget(obj);
if (w instanceof JRDesignElementWidget)
{
widgets.add((JRDesignElementWidget)w);
}
}
move(widgets, delta);
return State.CHAIN_ONLY;
}
}
return State.REJECTED;
}