本文整理汇总了Java中org.netbeans.api.visual.action.WidgetAction.WidgetMouseEvent.getModifiersEx方法的典型用法代码示例。如果您正苦于以下问题:Java WidgetMouseEvent.getModifiersEx方法的具体用法?Java WidgetMouseEvent.getModifiersEx怎么用?Java WidgetMouseEvent.getModifiersEx使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.api.visual.action.WidgetAction.WidgetMouseEvent
的用法示例。
在下文中一共展示了WidgetMouseEvent.getModifiersEx方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mousePressed
import org.netbeans.api.visual.action.WidgetAction.WidgetMouseEvent; //导入方法依赖的package包/类
@Override
public State mousePressed (Widget widget, WidgetMouseEvent event) {
if (isLocked ())
return State.createLocked (widget, this);
if (enabled && (event.getModifiersEx() & modifiersExMask) == modifiersEx) {
scene = widget.getScene ();
scrollPane = findScrollPane (scene.getView ());
if (scrollPane != null) {
lastLocation = scene.convertSceneToView (widget.convertLocalToScene (event.getPoint ()));
SwingUtilities.convertPointToScreen (lastLocation, scene.getView ());
return State.createLocked (widget, this);
}
}
return State.REJECTED;
}
示例2: mousePressed
import org.netbeans.api.visual.action.WidgetAction.WidgetMouseEvent; //导入方法依赖的package包/类
public State mousePressed (Widget widget, WidgetMouseEvent event) {
if (isLocked ())
return State.createLocked (widget, this);
if (event.getButton () == MouseEvent.BUTTON1 || event.getButton () == MouseEvent.BUTTON3)
{
rightButton = event.getButton () == MouseEvent.BUTTON3;
widget.getScene().getView().requestFocus();
invertSelection = (event.getModifiersEx () & MouseEvent.CTRL_DOWN_MASK) != 0;
Point localLocation = event.getPoint ();
if (provider.isSelectionAllowed (widget, localLocation, invertSelection)) {
aiming = provider.isAimingAllowed (widget, localLocation, invertSelection);
if (aiming) {
updateState (widget, localLocation);
return State.createLocked (widget, this);
} else {
provider.select (widget, localLocation, invertSelection);
// check if the widget is still selected...
Object object = null;
if (widget instanceof SelectionWidget)
{
object = ((ObjectScene)widget.getScene()).findObject ( ((SelectionWidget)widget).getRealWidget() );
}
else
{
object = ((ObjectScene)widget.getScene()).findObject (widget);
}
if (!((ObjectScene)widget.getScene()).getSelectedObjects().contains (object))
{
return State.CONSUMED;
}
return State.CHAIN_ONLY;
}
}
}
return State.REJECTED;
}