⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 e764. setting the number of visible items in the menu of a jcombobox component.txt

📁 这里面包含了一百多个JAVA源文件
💻 TXT
字号:
By default, the menu of a combobox only shows eight items. If there are more items in the menu, a scrollbar is automatically created. To change the default of eight, use JComboBox.setMaximumRowCount(). 
    // Create a read-only combobox with lots of items
    String[] items = new String[50];
    for (int i=0; i<items.length; i++) {
        items[i] = "" + Math.random();
    }
    JComboBox cb = new JComboBox(items);
    
    // Retrieve the current max visible rows
    int maxVisibleRows = cb.getMaximumRowCount();
    
    // Change the current max visible rows
    maxVisibleRows = 20;
    cb.setMaximumRowCount(maxVisibleRows);

⌨️ 快捷键说明

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