gpt4 book ai didi

java - SWT 按钮 - 删除按钮背景

转载 作者:行者123 更新时间:2023-11-29 03:15:09 25 4
gpt4 key购买 nike

我有一个看起来像这样的按钮:

我想删除按钮背景。也就是说,图像将成为按钮。这是我的代码:

Button button = new Button(shell, SWT.NONE);
button.setToolTipText("Email Settings...");
button.setImage(SWTResourceManager.getImage(Settings.class, "settings1616.png"));
button.setBounds(494, 26, 28, 25);

我试过了..

button.setBackground(null);
button.setBackgroundImage(null);

但它不会删除任何内容。谢谢!

最佳答案

请尝试使用 SWT Image HyperLink,它没有按钮背景,它可以解决您的问题。

添加 org.eclipse.ui.forms 作为依赖项。

ImageHyperlink 超链接 = new ImageHyperlink(parentComposite, SWT.NONE);
hyperlink.setImage("图片位置");

关于java - SWT 按钮 - 删除按钮背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27109374/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com