e756. creating a jcombobox component.txt

来自「这里面包含了一百多个JAVA源文件」· 文本 代码 · 共 11 行

TXT
11
字号
// Create a read-only combobox
    String[] items = {"item1", "item2"};
    JComboBox readOnlyCB = new JComboBox(items);

By default, a combobox only allows the user to select from a predefined list of values. The combobox can be made editable which not only allows the user to select from the predefined list but also to type in any string. 
    // Create an editable combobox
    items = new String[]{"item1", "item2"};
    JComboBox editableCB = new JComboBox(items);
    editableCB.setEditable(true);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?