我正在寻找在SWT / JFace对话框中显示图像的提示/教程。
有人可以指出我正确的方式吗?
答案 0 :(得分:2)
如果可以点击:
Image image = new Image(display,
ShellWithButtonShowingEclipseLogo.class.getResourceAsStream(
"yourpicture"));
Button button = new Button(shell,SWT.PUSH);
button.setImage(image);
如果无法点击,则可以使用标签代替按钮。
答案 1 :(得分:0)
从你的问题我知道你正试图展示 daialog Box标题区域中的图像。
您可以使用“setTitleImage(图像图像)”功能 你的主类(扩展Dialog的类)
示例:
class DemoDialog extends TitleAreaDialog {
public DemoDialog(Shell parentShell) {
super(parentShell);
}
protected Control createDialogArea(Composite parent) {
setTitle("Demo dialog...");
setTitleImage(ImageObject) // Image to be displayed in your Dialog
}
}