概述
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方法代码示例所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复