java – TitleAreaDialog – 调整标题图像
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了java – TitleAreaDialog – 调整标题图像,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2542字,纯文字阅读大概需要4分钟。
内容图文
所以我正在创建一个放置在标题区域的图像.除了仅显示1/4的图像外,一切都有效吗?
我的图像实际上是文本和图像组合在一个图像EX:JKTeater []< - 图标
所以现在只有JKT出现在标题区域
这是create()方法
public void create() {
super.create();
setTitle("JKTeater Application");
setMessage("Hello World");
if (image != null) setTitleImage(image);
}
>标题区域代码是否允许使用特定大小?
>有没有办法将图像的末尾放在标题区域的末尾?
>你可以使用布局来移动它吗?
>如何在标题区域的底部获得黑色水平线?
编辑
我相信,如果能够将背景颜色从基本颜色更改为渐变,那将是一个很大的问题
解决方法:
这是一个示例TitleAreaDialog.如您所见,图像完全显示并向右对齐:
public static void main(String[] args) {
final Shell shell = new Shell();
shell.setLayout(new FillLayout());
TitleAreaDialog dialog = new MyTitleAreaDialog(shell);
dialog.setTitleAreaColor(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND).getRGB());
dialog.open();
}
private static class MyTitleAreaDialog extends TitleAreaDialog
{
private Image image;
public MyTitleAreaDialog(Shell parentShell) {
super(parentShell);
image = new Image(Display.getDefault(), "/home/baz/Desktop/StackOverflow.png");
}
@Override
public boolean close() {
if (image != null)
image.dispose();
return super.close();
}
@Override
protected Control createContents(Composite parent) {
Control contents = super.createContents(parent);
setTitle("Title");
setMessage("Message");
if (image != null)
setTitleImage(image);
return contents;
}
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
// YOUR LINE HERE!
Label line = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
line.setLayoutData(new GridData(SWT.FILL, SWT.END, true, true));
return composite;
}
}
Is there a specific size that the title area code allows for?
AFAIK对尺寸没有限制.我尝试使用大于我的屏幕分辨率的图像并完全显示.尽管如此,Dialog显然无法使用.
I am sure that it would be asking to much to see if you can actually change the background color from a basic color to a gradient
可以使用dialog.setTitleAreaColor(RGB)(在本例中为窗口小部件背景颜色)更改背景颜色,但不能使用渐变.有一个不推荐使用的方法getTitleArea()将返回标题区域Composite,但我真的不建议使用它.
How can I get a black horizonal line at the bottom of the title area?
底部的线是通过使用:
Label line = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
line.setLayoutData(new GridData(SWT.FILL, SWT.END, true, true));
Can you use a layout to move it around?
这里有一个类似的问题:
Moving an image of a TitleAreaDialog to the left
那里的答案解释了如何更改TitleAreaDialog的细节.也许读一读.
内容总结
以上是互联网集市为您收集整理的java – TitleAreaDialog – 调整标题图像全部内容,希望文章能够帮你解决java – TitleAreaDialog – 调整标题图像所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。