Textinput 中的 Eclipse RCP 清除按钮

发布于 2024-12-16 16:39:38 字数 282 浏览 2 评论 0原文

我刚刚开始在公司开发 Eclipse RCP 应用程序,现在搜索以下组件:

在 Eclipse 首选项对话框中,有一个带有橡皮擦的文本输入字段,可以清除文本框(见图)。

在此处输入图像描述

eclipse RCP 中是否有一个组件可以完全执行此操作?或者我可以在文本输入字段中设置图像,这样我就可以实现功能。

或者我必须编写自己的从 Text 扩展的组件吗?

谢谢。

I just started working on an eclipse RCP application in my company and search now for following component:

In the eclipse preference dialog is a text input field with a eraser which clears the text box (see image).

enter image description here

Is there a component in eclipse RCP which does exactly that? Or one where I can set an image in a text input field, so I can implement just the functionality.

Or have I to write my own component extending from Text?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

愚人国度 2024-12-23 16:39:38

Eclipse 不提供这样的组件,因此您必须自己实现一个。

但我不会为此扩展 Text 。只需创建一个具有 SWT.BORDER 样式的 Composite,以及一个 TextButton 作为子项。如果您没有为 Text 提供边框,则按钮看起来就像位于文本框中。您可以使用带有单个 ToolItemToolBar 来代替 Button,两者都具有 SWT.FLAT 样式。这看起来比普通按钮要好得多。

Eclipse does not offer such a component, so you will have to implement one yourself.

But I wouldn't extend Text for this. Simply create a Composite with SWT.BORDER style, and a Text and Button as children. If you don't give the Text a border, it looks like the button is within the text box. Instead of the Button you could use a ToolBar with a single ToolItem, both with the SWT.FLAT style. This will look much better than a regular button.

苏佲洛 2024-12-23 16:39:38
Text text = new Text(parent, SWT.SEARCH | SWT.ICON_CANCEL);

这存在于 Luna 的 API 中,不知道旧版本是否如此。您可以在此处查看更多信息: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/ Snippet309.java?view=co

Text text = new Text(parent, SWT.SEARCH | SWT.ICON_CANCEL);

This is present in Luna's API, don't know about older versions. You can check more here: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet309.java?view=co

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文