隐藏 JComBox 框箭头
是否可以隐藏 JComboBox 中显示的箭头
我尝试设置:
combo.getComponent(0).setSize(new Dimension(1,1));
但它似乎不起作用
Is it possible to hide the arrow displayed in the JComboBox
I tried setting:
combo.getComponent(0).setSize(new Dimension(1,1));
But it doesnt seem to work
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须为此创建一个新的组合框 UI:
但要小心从与您当前的外观和感觉相匹配的基本 UI 继承。
例如,如果您使用 Substance,则应从
SubstanceComboBoxUI
而不是BasicComboBoxUI
派生新 UI。否则,您可能会失去当前 L&F 提供的功能。编辑:如果您希望获得某种自动完成功能,最好坚持使用普通的
JTextField
并使用中的AutoCompleteDecorator
href="http://swingx.java.net/" rel="noreferrer">SwingX。You have to create a new combobox UI for that:
But be careful to inherited from the base UI which matches your current look and feel.
For example if you are using Substance you should derive your new UI from
SubstanceComboBoxUI
instead ofBasicComboBoxUI
. Otherwise you'll might loose features provided by your current L&F.EDIT: If you want this to get some kind of auto-completion feature it's better to stick with a normal
JTextField
and useAutoCompleteDecorator
from SwingX.我一直在寻找解决方案,事实证明,真正需要做的就是记住
JComboBox
是一个复合组件。感谢 mKorbel 提供的 提醒。
I've been looking for a solution to this for a while now, and it turns out that all it really takes is remembering that
JComboBox
is a compound component.Thanks go to mKorbel for the reminder.