我使用 this 构造函数在JavaFX中创建了TextInputDialog
:
public class CostumTextInputDialog extends TextInputDialog {
public CostumTextInputDialog(String headerText, String contentText, String iconURL) throws FileNotFoundException {
setHeaderText(headerText);
setContentText(contentText);
getDialogPane().setMinSize(400,260);
setGraphic(new ImageView(new Image(new FileInputStream(iconURL))));
getGraphic().maxWidth(20);
getGraphic().maxHeight(20);
showAndWait();
}
}
我在这里调用了构造函数,并在构造函数中定义的参数中传递了图标的URL,但是图标太大了,我尝试调整其大小,但由于某种原因它无法正常工作,这是代码:
CostumTextInputDialog coverDialog = new CostumTextInputDialog(
"Creating a new table",
"Enter cover count :",
"src\\ICONS\\team.png");
我在这里想念什么?
这是将MaxWidth和MaxHeight设置为20px