我有一个主要的JFrame
窗格,使用Java的Swing嵌入了JComboBox
并带有许多选择。
打开时一切启动良好,但是当我在JTextField
中书写时,JComboBox中的单词消失了。
我通过以下方式启动JComboBox
:
private static String[] options = new String[] {"Search your own pasted text" , "Search your own file",
"Search website", "Search Lyric Database", "Search Books Database"};
private static JComboBox<String> bookList = new JComboBox<>(options);
然后我以这种方式启动JTextField
private static JTextField textFieldTheme = new JTextField(50);
private static String theme = textFieldTheme.getText();
不知道他们为什么互相干扰。...一切仍然正常。实际上,我可以坚持单击JComboBox
菜单,只是它会调整大小,单词从中消失