Advanced OOP MCS-3 OOP BSCS-3 Lecture # 9
GUI Components - > JFrame ->JComboBoxGUI Components - > JFrame ->JComboBox (javax.Swing.JComboBox) JComboBox() JComboBox(Object[]) void addItem(Object) void insertItemAt(Object, int) Object getItemAt(int) int getMaximumRowCount() Object getSelectedItem() int getSelectedIndex() void removeAllItems() void removeItemAt(int) void removeItem(Object) void setEditable(boolean) void setMaximumRowCount(int) boolean isEditable() TOPICS TO COVER
GUI Components - > JFrame ->JList (javax.Swing.JList) GUI Components - > JFrame ->JList JList() JList(Object[]) voidaddSelectionInterval(int, int) void clearSelection() int getSelectedIndex() int[] getSelectedIndices() Object getSelectedValue() Object[] getSelectValuesList() int getVisibleRowCount() boolean isSelectedIndex(int)//index boolean isSelectionEmpty() void setSelectedIndex(int)//index void setSelectedIndices(int[]) void setToolTipText(String) void setVisibleRowCount(int) TOPICS TO COVER
GUI Components - > JFrame ->JList GUI Components - > JFrame ->JList Single Selection Lists ListSelectionModel.SINGLE_SELECTION Multiple Selection Lists ListSelectionModel.SINGLE_INTERVAL_SELECTION ListSelectionModel.MULTIPLE_INTERVAL_SELECTION int getSelectionMode() void setSelectionMode(int)// selectionMode void setModel(DefaultListModel)// for adding elements in spite of constructor Javax.swing.DefaultListModel DefaultListModel() void addElement(String) TOPICS TO COVER
Ways of Arranging Components in GUI Uses Container class setLayout() method from java.awt package Absolute Positioning Provides greatest level of control by setting setLayout method to null. But it can be tedious to set absolute positioning. Methods like setSize, setLocation, and setBounds are used. Layout Managers FlowLayout BorderLayout GridLayout Visual Programming in an IDE Provides GUI design tool. Supports drag and drop.
GOOD LUCK ! ☻...