本文整理汇总了Java中edu.umd.cs.piccolo.event.PInputEvent.getComponent方法的典型用法代码示例。如果您正苦于以下问题:Java PInputEvent.getComponent方法的具体用法?Java PInputEvent.getComponent怎么用?Java PInputEvent.getComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.umd.cs.piccolo.event.PInputEvent
的用法示例。
在下文中一共展示了PInputEvent.getComponent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mouseReleased
import edu.umd.cs.piccolo.event.PInputEvent; //导入方法依赖的package包/类
public void mouseReleased( PInputEvent event, Cursor cursor ) {
JComponent component = ((JComponent)event.getComponent());
if ( mouseOverPnode ) {
component.setCursor( cursor );
}else{
component.setCursor( Cursor.getDefaultCursor() );
}
}
示例2: mousePressed
import edu.umd.cs.piccolo.event.PInputEvent; //导入方法依赖的package包/类
public void mousePressed( PInputEvent event, Cursor cursor ) {
Component component = (JComponent) event.getComponent();
// Usually, the cursor would have been set when the mouseEntered
// event was received. However, it is possible that the user
// pressed, released, and is now pressing again, and in that case
// the altered cursor should be set.
if ( component.getCursor() != cursor ) {
component.setCursor( cursor );
}
}
示例3: mouseEntered
import edu.umd.cs.piccolo.event.PInputEvent; //导入方法依赖的package包/类
public void mouseEntered( PInputEvent event ) {
double eventX = event.getPositionRelativeTo( centralCurve.getParent() ).getX();
if( eventX >= xMin && eventX <= xMax && manipulable ) {
PhetPCanvas ppc = (PhetPCanvas)event.getComponent();
ppc.setCursor( new Cursor( Cursor.N_RESIZE_CURSOR ) );
}
}
示例4: handleMouse
import edu.umd.cs.piccolo.event.PInputEvent; //导入方法依赖的package包/类
private void handleMouse( PInputEvent event, Cursor predefinedCursor ) {
PComponent o = event.getComponent();
if ( o instanceof JComponent ) {
JComponent jComponent = (JComponent) o;
Window w = SwingUtilities.getWindowAncestor( jComponent );
if ( w instanceof JFrame ) {
JFrame frame = (JFrame) w;
Container contentPane = frame.getContentPane();
setCursorHand( contentPane, predefinedCursor );
}
}
}
示例5: mouseExited
import edu.umd.cs.piccolo.event.PInputEvent; //导入方法依赖的package包/类
public void mouseExited( PInputEvent event ) {
PhetPCanvas ppc = (PhetPCanvas)event.getComponent();
ppc.setCursor( Cursor.getDefaultCursor() );
}
示例6: mouseEntered
import edu.umd.cs.piccolo.event.PInputEvent; //导入方法依赖的package包/类
public void mouseEntered( PInputEvent event ) {
super.mouseEntered( event );
mouseOverComponent = (JComponent) event.getComponent();
}