本文整理匯總了Java中javafx.scene.control.Label.setOnMouseEntered方法的典型用法代碼示例。如果您正苦於以下問題:Java Label.setOnMouseEntered方法的具體用法?Java Label.setOnMouseEntered怎麽用?Java Label.setOnMouseEntered使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.control.Label
的用法示例。
在下文中一共展示了Label.setOnMouseEntered方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: rotateHer
import javafx.scene.control.Label; //導入方法依賴的package包/類
public void rotateHer(Label labelHer, ImageView iv)
{
RotateTransition rotation = new RotateTransition(Duration.seconds(2), iv);
rotation.setCycleCount(Animation.INDEFINITE);
rotation.setByAngle(360);
iv.setTranslateZ(iv.getBoundsInLocal().getWidth() / 2.0);
iv.setRotationAxis(Rotate.Y_AXIS);
labelHer.setOnMouseEntered(e ->
{
rotation.play();
iv.setRotate(180);
});
labelHer.setOnMouseExited(e ->
{
rotation.pause();
iv.setRotate(0);
});
}
示例2: rotateHer
import javafx.scene.control.Label; //導入方法依賴的package包/類
public void rotateHer(Label labelHer, ImageView iv)
{
RotateTransition rotation = new RotateTransition(Duration.seconds(2.3), iv);
rotation.setCycleCount(Animation.INDEFINITE);
rotation.setByAngle(360);
iv.setTranslateZ(iv.getBoundsInLocal().getWidth() / 2.0);
iv.setRotationAxis(Rotate.Y_AXIS);
labelHer.setOnMouseEntered(e ->
{
rotation.play();
iv.setRotate(180);
});
labelHer.setOnMouseExited(e ->
{
rotation.pause();
iv.setRotate(0);
});
}
示例3: addListElement
import javafx.scene.control.Label; //導入方法依賴的package包/類
public void addListElement(final String s) {
final Label label = new Label(s);
label.setStyle("-fx-padding: 8 16 8 16;");
label.getStyleClass().add("body2");
label.setMinWidth(width);
list.getChildren().add(label);
label.setOnMouseEntered(event -> canIShowSubMenu.set(false));
}
示例4: initializeHeadline
import javafx.scene.control.Label; //導入方法依賴的package包/類
private void initializeHeadline(final Component component) {
final Label headline = (Label) lookup("#headline");
final Circle indicator = (Circle) lookup("#indicator");
final Line line = (Line) lookup("#line");
line.setStroke(Color.GREY.getColor(Color.Intensity.I400));
// This is an project wide message that is not specific to a component
if(component == null) {
headline.setText("Project");
return;
}
headline.setText(component.getName());
headline.textProperty().bind(component.nameProperty());
final EventHandler<MouseEvent> onMouseEntered = event -> {
setCursor(Cursor.HAND);
headline.setStyle("-fx-underline: true;");
};
final EventHandler<MouseEvent> onMouseExited = event -> {
setCursor(Cursor.DEFAULT);
headline.setStyle("-fx-underline: false;");
};
final EventHandler<MouseEvent> onMousePressed = event -> {
CanvasController.setActiveComponent(component);
};
headline.setOnMouseEntered(onMouseEntered);
headline.setOnMouseExited(onMouseExited);
headline.setOnMousePressed(onMousePressed);
indicator.setOnMouseEntered(onMouseEntered);
indicator.setOnMouseExited(onMouseExited);
indicator.setOnMousePressed(onMousePressed);
final BiConsumer<Color, Color.Intensity> updateColor = (color, intensity) -> {
indicator.setFill(color.getColor(component.getColorIntensity()));
};
updateColor.accept(component.getColor(), component.getColorIntensity());
component.colorProperty().addListener((observable, oldColor, newColor) -> updateColor.accept(newColor, component.getColorIntensity()));
}