Bài giảng Lập trình cơ sở dữ liệu Java: Bài do GV. Nguyễn Hữu Thể biên soạn cung cấp cho người đọc các nội dung: List JTable, JMenu, JOptionPane, JFileChooser. nội dung chi tiết. | LẬP TRÌNH JAVA CSDL BÀI 3 COMPONENTS Nguyễn Hữu Thể 1 Nội dung JList JTable JMenu JOptionPane JFileChooser 2 JList Creating a Model There are three ways to create a list model: •DefaultListModel — everything is pretty much taken care of for you. The examples in this page use DefaultListModel. •AbstractListModel — you manage the data and invoke the "fire" methods. For this approach, you must subclass AbstractListModel and implement the getSize and getElementAt methods inherited from the ListModel interface. •ListModel — you manage everything. JList Initializing a List list = new JList(data); //data has type Object[] ( LECTION); (); (-1); . JScrollPane listScroller = new JScrollPane(list); (new Dimension(250, 80)); JList DefaultListModel Methods: • addElement (Object e) • get (int index) • getSize () • getElementAt (int index) • remove (int index) • Elements() • removeAllElements .