Reputation: 306
I have a problem with changing the size of the Alert buttons.
Alert alert = new Alert(alertType);
alert.setTitle(titulo);
alert.setHeaderText(encabezado);
alert.setContentText(mensaje);
ButtonType button1 = new ButtonType(mensajeBoton1);
ButtonType button2 = new ButtonType(mensajeBoton2);
alert.getButtonTypes().setAll(button1, button2);
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == button1) {
return Dialog.Actions.OK;
}
The problem is because the buttonType is small, and it is for use on a touch screen.
Upvotes: 0
Views: 882
Reputation: 49185
You may access them by dialogPane.lookupButton()
and apply custom style to them:
for ( ButtonType bt : alert.getDialogPane().getButtonTypes() )
{
Button button = ( Button ) alert.getDialogPane().lookupButton( bt );
button.setPadding( new Insets( 20 ) );
// or define css style and apply it
button.getStyleClass().add( "big-button" );
}
Upvotes: 1