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.
您好我正在尝试使用 Java Swing 创建一个 JComboBox。
在创建 JCombobox 时,该框的内容尚未确定。因此我不能使用构造函数:
String[] selectionArray = {........}; JComboBox myComboBox = new JComboBox(selectionArray);
我想在创建 JComboBox 之后分配数据(字符串数组)。
我环顾 API 并没有找到相应的方法来执行此操作。
有人可以指出我正确的方向吗?
非常感谢。
寻找DefaultComboBoxModel和JComboBox.setModel()方法。