Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我一添加
String[] possibleClasses = {"12", "11", "10", "9", "8", "7", "6", "5"}; JComboBox classes = new JComboBox(possibleClasses);
对于我的任何程序,框架中都没有显示任何摆动组件。我唯一得到的是一个空框架。使用 JComboBox 有什么秘密吗?
仅仅创建 aJComboBox不足以让你的组件出现在 中JFrame,你需要将它添加到容器中:
JComboBox
JFrame
myJFrame.add(classes);