首页 文章

如何在HBox中定位按钮 - JAVAFx

提问于
浏览
0

我是JAVAfx的新手,我试图编写Web浏览器代码 . 我面临的问题是: - 我想把按钮放在 Bottom left of the screen to the bottom right.

我正在尝试此代码,但它无法正常工作 . 有人请帮忙

Button Developer = new Button(); 
Developer.setAlignment(Pos.BOTTOM_RIGHT);

这是截图:http://i.stack.imgur.com/4RTpr.png

谢谢

1 回答

  • 2

    您应该能够在 HBox 上设置对齐而不是 Button 本身 .

    Button developer = new Button(); 
    
    HBox hbox = new HBox();
    hbox.setAlignment(Pos.BOTTOM_RIGHT);
    hbox.getChildren().add(developer);
    

相关问题