javafx.scene.input.MouseEvent.getSource()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(147)

本文整理了Java中javafx.scene.input.MouseEvent.getSource()方法的一些代码示例,展示了MouseEvent.getSource()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MouseEvent.getSource()方法的具体详情如下:
包路径:javafx.scene.input.MouseEvent
类名称:MouseEvent
方法名:getSource

MouseEvent.getSource介绍

暂无

代码示例

代码示例来源:origin: jfoenixadmin/JFoenix

return;
DateCell selectedDayCell = (DateCell) click.getSource();
selectDayCell(selectedDayCell);
currentFocusedDayCell = selectedDayCell;

代码示例来源:origin: nl.cloudfarming.client/calendar-api

protected void mouseClicked(MouseEvent mouseEvent) {
  if (axisEventHandler != null) {
    Node node = (Node) mouseEvent.getSource();
    double position = node.getLayoutX() + node.getLayoutBounds().getWidth() / 2;
    DateTime clickedDate = getValueForDisplay(position);
    AxisEvent<DateTime> event = new AxisEvent<>(clickedDate);
    axisEventHandler.handle(event);
  }
}

代码示例来源:origin: org.jrebirth.af/component

/**
 * {@inheritDoc}
 */
@Override
public void mouseDragDetected(final MouseEvent mouseEvent) {
  final ToggleButton b = (ToggleButton) mouseEvent.getSource();
  final Dragboard db = b.startDragAndDrop(TransferMode.MOVE);
  // Put a TabBB on a dragboard
  final ClipboardContent content = new ClipboardContent();
  content.put(CustomDataFormat.DOCKABLE, b.getUserData());
  db.setContent(content);
  mouseEvent.consume();
}

代码示例来源:origin: org.refcodes/refcodes-graphical-ext-javafx

@Override
  public void handle( MouseEvent aEvent ) {
    Node theSprite = (Node) (aEvent.getSource());
    double theSceneOffsetX = aEvent.getSceneX() - _sceneX;
    double theSceneOffsetY = aEvent.getSceneY() - _sceneY;
    double theTranslateX = _posX + theSceneOffsetX;
    double theTranslateY = _posY + theSceneOffsetY;
    switch ( _moveMode ) {
    case SMOOTH:
      theTranslateX = toBoundsX( theTranslateX, theSprite );
      theTranslateY = toBoundsY( theTranslateY, theSprite );
      break;
    case JUMPY:
      theTranslateX = toSnapX( theTranslateX, theSprite );
      theTranslateY = toSnapY( theTranslateY, theSprite );
      break;
    }
    theSprite.setTranslateX( theTranslateX );
    theSprite.setTranslateY( theTranslateY );
    _offsetX = (int) Math.round( theTranslateX / (getFieldWidth() + getFieldGap()) );
    _offsetY = (int) Math.round( theTranslateY / (getFieldHeight() + getFieldGap()) );
    aEvent.consume();
  }
};

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls

void tabPane_handleDragStart(MouseEvent event) {
  try {
    Field f_tab = event.getSource().getClass().getDeclaredField("tab"); //$NON-NLS-1$
    f_tab.setAccessible(true);
    Tab t = (Tab) f_tab.get(event.getSource());
      Node node = (Node) event.getSource();
      Dragboard db = node.startDragAndDrop(TransferMode.MOVE);

代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.ui.controls

void tabPane_handleDragStart(MouseEvent event) {
  try {
    Field f_tab = event.getSource().getClass().getDeclaredField("tab"); //$NON-NLS-1$
    f_tab.setAccessible(true);
    Tab t = (Tab) f_tab.get(event.getSource());
      Node node = (Node) event.getSource();
      Dragboard db = node.startDragAndDrop(TransferMode.MOVE);

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls

void tabPane_handleDragStart(MouseEvent event) {
  try {
    Field f_tab = event.getSource().getClass().getDeclaredField("tab"); //$NON-NLS-1$
    f_tab.setAccessible(true);
    Tab t = (Tab) f_tab.get(event.getSource());
      Node n = (Node) event.getSource();
      n.startFullDrag();
      EFXDragEvent evt = new EFXDragEvent(event.getSource(), event.getTarget(), EFXDragEvent.DRAG_START, event.getScreenX(), event.getScreenY(), false);
      evt.setDraggedContent(data);
      evt.updateFeedback(p -> {

代码示例来源:origin: com.bitplan.dragtop/com.bitplan.dragtop

private void activateDrag() {
  setOnMousePressed((t) -> {
   dragSceneX = t.getSceneX();
   dragSceneY = t.getSceneY();
   DragItem d = (DragItem) (t.getSource());
   d.toFront();
  });
  setOnMouseDragged((event) -> {
   DragItem d = (DragItem) (event.getSource());
   double offsetX = event.getSceneX() - dragSceneX;
   double offsetY = event.getSceneY() - dragSceneY;

   d.setLayoutX(d.getLayoutX() + offsetX);
   d.setLayoutY(d.getLayoutY() + offsetY);
   dragSceneX = event.getSceneX();
   dragSceneY = event.getSceneY();
  });

 }
}

代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay

hirePirateEventHandler =   event -> {
  try {
    boolean wholeHanseFlag = ((Node) event.getSource()).getId().equals("wholeHanse");
    final INonFreeSeaPirate seaPirate = peopleFactory.createNewPirate(pirate.getName(), currentShip.get(), city.getPlayer(), wholeHanseFlag ? null : city.getCity());
    seaPiratesState.add(seaPirate);

代码示例来源:origin: org.refcodes/refcodes-graphical-ext-javafx

@Override
  public void handle( MouseEvent aEvent ) {
    Node theSprite = (Node) (aEvent.getSource());
    _prevOpacity = theSprite.getOpacity();
    theSprite.setOpacity( _dragOpacity );
    _sceneX = aEvent.getSceneX();
    _sceneY = aEvent.getSceneY();
    _posX = theSprite.getTranslateX();
    _posY = theSprite.getTranslateY();
    if ( LOGGER.isLogDebug() ) {
      LOGGER.debug( "Sprite mouse press X := " + aEvent.getSceneX() );
      LOGGER.debug( "Sprite mouse press Y := " + aEvent.getSceneY() );
    }
    aEvent.consume();
  }
};

代码示例来源:origin: org.refcodes/refcodes-graphical-ext-javafx

@Override
public void handle( MouseEvent aEvent ) {
  Node theSprite = (Node) (aEvent.getSource());
  double theSceneOffsetX = aEvent.getSceneX() - _sceneX;
  double theSceneOffsetY = aEvent.getSceneY() - _sceneY;

代码示例来源:origin: com.jfoenix/jfoenix

return;
DateCell selectedDayCell = (DateCell) click.getSource();
selectDayCell(selectedDayCell);
currentFocusedDayCell = selectedDayCell;

相关文章