本文整理了Java中javafx.scene.shape.Rectangle.setManaged
方法的一些代码示例,展示了Rectangle.setManaged
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Rectangle.setManaged
方法的具体详情如下:
包路径:javafx.scene.shape.Rectangle
类名称:Rectangle
方法名:setManaged
暂无
代码示例来源:origin: stackoverflow.com
@Override
public void start(Stage primaryStage) {
Rectangle rect = new Rectangle(100, 100, Color.LIME);
VBox root = new VBox(new Rectangle(100, 100, Color.RED),
rect,
new Rectangle(100, 100, Color.BLUE));
Scene scene = new Scene(root, 200, 300);
scene.setOnMouseClicked(evt -> {
rect.setManaged(!rect.isManaged());
rect.setVisible(!rect.isVisible());
});
primaryStage.setScene(scene);
primaryStage.show();
}
代码示例来源:origin: stackoverflow.com
rect.setManaged(false);
代码示例来源:origin: org.controlsfx/controlsfx
/**
* Styles the selected and unselected area.
*/
private void styleAreas() {
selectedArea.fillProperty().bind(getSkinnable().selectionAreaFillProperty());
selectedArea.strokeProperty().bind(getSkinnable().selectionBorderPaintProperty());
selectedArea.strokeWidthProperty().bind(getSkinnable().selectionBorderWidthProperty());
selectedArea.setStrokeType(StrokeType.OUTSIDE);
// if the control's layout depends on this rectangle,
// the stroke's width messes up the layout if the selection is on the pane's edge
selectedArea.setManaged(false);
selectedArea.setMouseTransparent(true);
unselectedArea.setFill(Color.TRANSPARENT);
unselectedArea.strokeProperty().bind(getSkinnable().unselectedAreaFillProperty());
unselectedArea.strokeWidthProperty().bind(
Bindings.max(getSkinnable().widthProperty(), getSkinnable().heightProperty()));
unselectedArea.setStrokeType(StrokeType.OUTSIDE);
// this call is crucial! it prevents the enormous unselected area from messing up the layout
unselectedArea.setManaged(false);
unselectedArea.setMouseTransparent(true);
}
代码示例来源:origin: org.controlsfx/controlsfx
/**
* Creates the node which will be used to capture mouse events. Events are handed over to
* {@link #handleMouseEvent(MouseEvent) handleMouseEvent}.
*
* @return a {@link Node}
*/
private Node createMouseNode() {
Rectangle mouseNode = new Rectangle();
// make the node transparent and make sure its size does not affect the control's size
mouseNode.setFill(Color.TRANSPARENT);
mouseNode.setManaged(false);
// bind width and height to the control
mouseNode.widthProperty().bind(getSkinnable().widthProperty());
mouseNode.heightProperty().bind(getSkinnable().heightProperty());
// let it handle the mouse events if allowed by the user
mouseNode.addEventHandler(MouseEvent.ANY, this::handleMouseEvent);
mouseNode.mouseTransparentProperty().bind(getSkinnable().selectionMouseTransparentProperty());
return mouseNode;
}
内容来源于网络,如有侵权,请联系作者删除!