[英]Is there any way to add a button to a canvas using javafx
好吧所以我想制作一个简单的游戏,所以我用画布绘制角色,现在我需要在这个画布上添加一个按钮,让角色移动,我找不到在javaFX中这样做的方法
You can put your canvas into an AnchorPane and then you can add a Button to that too which will be shown on top of the canvas then. 您可以将画布放入AnchorPane,然后您也可以添加一个Button,然后将其显示在画布顶部。 With the anchors you can place the button exactly where you want to have it.
使用锚点,您可以将按钮准确放置在您想要的位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.