如何在JComboBox中加载Tree? [英] how to load Tree inside JComboBox?
问题描述
如何在JComboBox弹出窗口中显示树? p>
这是示例树:
Theoretical computer science
Mathematical logic
Automata theory
Algorithms and data structures
Analysis of algorithms
Algorithms
没有默认方法将树放入组合框.有两种选择:
如果可以允许节点扩展,则可以通过在标准JComobBox中的某些选项之前添加空间来达到类似的效果.甚至在叶子选项前还有空格和破折号.
如果需要扩展节点,那么更好的选择是添加一个弹出窗口,该弹出窗口将显示在按钮下方,该按钮用于侦听树中的项目选择.根据GUI的布局,类似这样的选择可能是更好的选择.
How can I show a tree inside a JComboBox popup?
Here is example tree:
Theoretical computer science
Mathematical logic
Automata theory
Algorithms and data structures
Analysis of algorithms
Algorithms
There is no default way to put a tree in a combo box. There are a couple of options:
If you can give allowing expansion of nodes, you can achieve a similar effect by adding space before some of the options in a standard JComobBox. Or even space and a dash in front of leaf options.
If you need expansion of nodes, then a better option would be to add a popup that appears below a button that listens for selections of items in the tree. Something like this might be a better choice depending on how your GUI is laid out.
这篇关于如何在JComboBox中加载Tree?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!