简体   繁体   中英

Re-Sizing GridPane Buttons Without Text

I'm creating a JavaFX application that involves buttons laid out upon a GridPane. I've set the buttons max height and max width using:

button.setMaxWidth(Double.MAX_Value);  

and:

button.setMaxHeight(Double.MAX_Value);  

As well as:

GridPane.setFillWidth(button, true);  

However my button only extends to the row/column span specified within:

grid.add();  

When there is text on the button, is their any way of extending the size of the button without it having a text value?

setMaxHeight()/setMaxWidth() sets the maximum size for the button, as in it cannot grow bigger than that. You want to set the minimum size, so that it is at least that big. Change it to setMinHeight()/setMinWidth():

button.setMinWidth(Double.MAX_Value);
button.setMinHeight(Double.MAX_Value);  

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM