本文整理汇总了Java中javafx.scene.shape.Rectangle.setOnMouseEntered方法的典型用法代码示例。如果您正苦于以下问题:Java Rectangle.setOnMouseEntered方法的具体用法?Java Rectangle.setOnMouseEntered怎么用?Java Rectangle.setOnMouseEntered使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.shape.Rectangle
的用法示例。
在下文中一共展示了Rectangle.setOnMouseEntered方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateTopGroup
import javafx.scene.shape.Rectangle; //导入方法依赖的package包/类
public void updateTopGroup() {
if(!store.isEmpty()) {
Rectangle temp = (Rectangle) super.getChildren().get(super.getChildren().size()-1);
temp.setOnMouseEntered(e -> {
temp.setStroke(Color.GOLD);
temp.setStrokeWidth(2);
});
temp.setOnMouseExited(e -> {
temp.setStroke(Color.GRAY);
temp.setStrokeWidth(1);
});
}
}
示例2: initCommon
import javafx.scene.shape.Rectangle; //导入方法依赖的package包/类
/**
* Create mouse events and context menu entries.
*/
private void initCommon() {
view.setDurations(concreteSpec.getDurations());
// view.getyAxis().layoutBoundsProperty().addListener(change -> updateAxisExternalPosition());
view.setOnMouseClicked(this::onMouseClicked);
MenuItem xpositiveZoomItem = new MenuItem("Zoom X+");
xpositiveZoomItem.setOnAction(this::onXPositiveZoom);
MenuItem xnegativeZoomItem = new MenuItem("Zoom X-");
xnegativeZoomItem.setOnAction(this::onXNegativeZoom);
view.getContextMenu().getItems().setAll(xpositiveZoomItem, xnegativeZoomItem);
ObservableList<Rectangle> cycleSelectionRectangles = view.getCycleSelectionRectangles();
for (int i = 0; i < cycleSelectionRectangles.size(); i++) {
Rectangle cycleSelectionRectangle = cycleSelectionRectangles.get(i);
int finalCycleIndex = i;
cycleSelectionRectangle.setOnMouseEntered(event -> {
if (activated.get()) {
cycleSelectionRectangle.setOpacity(1);
selection.setRow(concreteSpec.cycleToRowNumber(finalCycleIndex));
selection.setColumn(ioVariable.getName());
}
});
cycleSelectionRectangle.setOnMouseExited(event -> {
if (activated.get()) {
cycleSelectionRectangle.setOpacity(0);
selection.clear();
}
});
cycleSelectionRectangle.setOnMouseClicked(event -> {
if (event.getButton() == MouseButton.PRIMARY) {
selection.fireClickEvent(ioVariable.getName(),
concreteSpec.cycleToRowNumber(finalCycleIndex));
}
});
}
}