TextInputDialog的图形不会调整大小

时间:2020-08-05 08:45:15

标签: javafx dialog

我使用 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

的样子

Dialog

0 个答案:

没有答案