我需要显示一个对话框,其中包含:一个标题、2 个命令(确定、取消)和一个图像,这工作正常,但我需要对话框中的图像更大,我尝试过:
image.scaled(x,y);
以及:
imageLabel.setSize(new Dimension(x,y));
但它们都不起作用,我的图像在资源文件中,我通过了它:
com.codename1.ui.util.Resources.getGlobalResources().getImage("imageid");
我的代码是:
Image alertImage = com.codename1.ui.util.Resources.getGlobalResources().getImage(alertImageId);
alertImage.scaled(500, 500);
Command commands[] = {new Command("Aceptar"),new Command("Cancelar")};
Label lblAlert = new Label(alertImage);
lblAlert.setSize(new Dimension(500,500));
Command result = Dialog.show(alertTitle, lblAlert, commands);
如何控制对话框中显示的图像的大小?
最佳答案
尝试:
alertImage = alertImage.scaled(500, 500);
关于java - 代号一 : How to set image size in a Label when shown in Dialog,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45182185/