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

📄 e774. creating a jlist component.txt

📁 这里面包含了一百多个JAVA源文件
💻 TXT
字号:
By default, a list allows more than one item to be selected. Also, the selected items need not be contiguous. To change this default, see e781 Setting the Selection Mode of a JList Component. 
A list selection event is fired when the set of selected items is changed (see e784 Listening for Changes to the Selection in a JList Component). 

    // Create a list with some items
    String[] items = {"A", "B", "C", "D"};
    JList list = new JList(items);

The items can be arbitrary objects. The toString() method of the objects is displayed in the list component. 
    // Create a list with two items - "123" and "Sun May 19 21:15:38 PDT 2002"
    Object[] items2 = {new Integer(123), new java.util.Date()};
    list = new JList(items2);

By default, a list does not automatically display a scrollbar when there are more items than can be displayed. The list must be wrapped in a scroll pane: 
    JScrollPane scrollingList = new JScrollPane(list);

⌨️ 快捷键说明

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