本文介绍了向左移动TitleAreaDialog的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在基于Java SE的SWT / Jface项目中,我想将TitleAreaDialog的图像移到左侧。可能吗 ?
I'm working on a SWT/Jface project based on Java SE, i want to move the image of a TitleAreaDialog to the left. is it possible ? if not is there anyway ?
谢谢
推荐答案
修改图像标签的布局数据,如下所示:
You can modify the layout data of the image label as follows:
TitleAreaDialog tad = new TitleAreaDialog(getShell()) {
@Override
protected Control createContents(Composite parent) {
Control control = super.createContents(parent);
Label label = getTitleImageLabel();
FormData data = (FormData) label.getLayoutData();
data.left = new FormAttachment(0, 0);
data.right = null;
return control;
}
};
tad.setTitle("title");
tad.setTitleImage(Activator.imageDescriptorFromPlugin(
Activator.PLUGIN_ID, "image.gif").createImage());
tad.open();
这篇关于向左移动TitleAreaDialog的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!