gpt4 book ai didi

css - 更改警报对话框按钮的大小

转载 作者:太空宇宙 更新时间:2023-11-04 11:32:54 25 4
gpt4 key购买 nike

我在更改警报按钮的大小时遇到​​问题。

  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;
}

问题是因为 buttonType 很小,而且是在触摸屏上使用。

最佳答案

您可以通过 dialogPane.lookupButton() 访问它们并为它们应用自定义样式:

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" );
}

关于css - 更改警报对话框按钮的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31923717/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com