本文整理汇总了Java中javafx.geometry.Bounds.intersects方法的典型用法代码示例。如果您正苦于以下问题:Java Bounds.intersects方法的具体用法?Java Bounds.intersects怎么用?Java Bounds.intersects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.geometry.Bounds
的用法示例。
在下文中一共展示了Bounds.intersects方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: layoutChildren
import javafx.geometry.Bounds; //导入方法依赖的package包/类
@Override
protected void layoutChildren(double contentX, double contentY,
double contentWidth, double contentHeight) {
super.layoutChildren(contentX, contentY, contentWidth, contentHeight);
int labelCount = labels.size();
// now label
LocalTime now = getSkinnable().getTime();
currentTimeLabel.setText(now.format(formatter));
placeLabel(currentTimeLabel, now, contentX, contentY, contentWidth,
contentHeight);
// hour labels
LocalTime startTime = getSkinnable().getStartTime();
LocalTime endTime = getSkinnable().getEndTime();
for (int hour = 0; hour < labelCount; hour++) {
LocalTime time = LocalTime.of(hour + 1, 0);
Label label = labels.get(hour);
label.getStyleClass().removeAll("early-hour-label", //$NON-NLS-1$
"late-hour-label"); //$NON-NLS-1$
placeLabel(label, time, contentX, contentY, contentWidth,
contentHeight);
Bounds localToParent1 = currentTimeLabel
.localToParent(currentTimeLabel.getLayoutBounds());
Bounds localToParent2 = label
.localToParent(label.getLayoutBounds());
if (currentTimeLabel.isVisible()
&& getSkinnable().isShowCurrentTimeMarker()
&& localToParent1.intersects(localToParent2)) {
label.setVisible(false);
} else {
label.setVisible(true);
}
if (time.isBefore(startTime)) {
if (!label.getStyleClass().contains("early-hour-label")) { //$NON-NLS-1$
label.getStyleClass().add("early-hour-label"); //$NON-NLS-1$
}
}
if (time.isAfter(endTime)) {
if (!label.getStyleClass().contains("late-hour-label")) { //$NON-NLS-1$
label.getStyleClass().add("late-hour-label"); //$NON-NLS-1$
}
}
if (label.isVisible()) {
switch (getSkinnable().getEarlyLateHoursStrategy()) {
case HIDE:
case SHOW_COMPRESSED:
if (time.isBefore(startTime) || time.isAfter(endTime)) {
label.setVisible(false);
}
break;
case SHOW:
label.setVisible(true);
break;
default:
break;
}
}
}
currentTimeLabel.toFront();
}