我是靠谱客的博主 深情画板,最近开发中收集的这篇文章主要介绍java circle_Java Circle.setOnMouseExited方法代码示例,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

import javafx.scene.shape.Circle; //导入方法依赖的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 onMouseEntered = event -> {

setCursor(Cursor.HAND);

headline.setStyle("-fx-underline: true;");

};

final EventHandler onMouseExited = event -> {

setCursor(Cursor.DEFAULT);

headline.setStyle("-fx-underline: false;");

};

final EventHandler 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 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()));

}

最后

以上就是深情画板为你收集整理的java circle_Java Circle.setOnMouseExited方法代码示例的全部内容,希望文章能够帮你解决java circle_Java Circle.setOnMouseExited方法代码示例所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(40)

评论列表共有 0 条评论

立即
投稿
返回
顶部