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.
每次发生某些事情时,我都想在 GUI 的组合框中更新我的列表。我从服务器收到一个新列表,作为String. 我的组合框类型列表static String unitsList[]。我尝试过使用逗号分隔符进行数组转换和拆分。
String
static String unitsList[]
如何传递String到组合框?
简单的...
JComboBox /*varname*/ = new JComboBox(/*string array here?*/);
使用addItem()
addItem()
例如,如果您的组合框被称为“示例”
Example.addItem("Test");