本文整理汇总了Java中edu.umd.cs.piccolo.event.PInputEvent.getButton方法的典型用法代码示例。如果您正苦于以下问题:Java PInputEvent.getButton方法的具体用法?Java PInputEvent.getButton怎么用?Java PInputEvent.getButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.umd.cs.piccolo.event.PInputEvent
的用法示例。
在下文中一共展示了PInputEvent.getButton方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mousePressed
import edu.umd.cs.piccolo.event.PInputEvent; //导入方法依赖的package包/类
/**
* A callback that is invoked any time the mouse is pressed on the canvas.
* If the press occurs directly on the canvas, it create a new PStyledText
* instance and puts it in editing mode. If the click is on a node, it marks
* changes it to editing mode.
*
* @param event mouse click event that can be queried
*/
public void mousePressed(final PInputEvent event) {
final PNode pickedNode = event.getPickedNode();
stopEditing(event);
if (event.getButton() != MouseEvent.BUTTON1) {
return;
}
if (pickedNode instanceof PStyledText) {
startEditing(event, (PStyledText) pickedNode);
}
else if (pickedNode instanceof PCamera) {
final PStyledText newText = createText();
final Insets pInsets = newText.getInsets();
newText.translate(event.getPosition().getX() - pInsets.left, event.getPosition().getY() - pInsets.top);
startEditing(event, newText);
}
}
示例2: mouseEntered
import edu.umd.cs.piccolo.event.PInputEvent; //导入方法依赖的package包/类
public void mouseEntered(final PInputEvent e) {
if (e.getButton() == 0) {
e.getPickedNode().setPaint(Color.red);
}
}
示例3: mouseExited
import edu.umd.cs.piccolo.event.PInputEvent; //导入方法依赖的package包/类
public void mouseExited(final PInputEvent e) {
if (e.getButton() == 0) {
e.getPickedNode().setPaint(Color.white);
}
}