22. JTable
Constructors
public JTable()
public JTable(int numRows, int numColumns)
public JTable(Object[][] data, Object[]
column)
public JTable(Vector data, Vector columns)
public JTable(TableModel model)
24. JTable
Drawbacks
All columns are of same width by default
Ellipsis is used for displaying data
Horizontal scrolling will not be activated
because of ellipsis
25. JTable
Creating a Custom JTable
AbstractTableModel
DefaultTableModel
26. AbstractTableModel
public int getRowCount()
public int getColumnCount()
public Object getValueAt(int row, int column)
fireTableDataChanged()
27. Steps:
Instantiate data model class
Instantiate JTable object
setData()
28. Event Handling
Register a MouseListener
Handle mouseClicked() method
36. Adding Tabs
Create JTabbedPane instance
Create JPanel instance for each tab
Add the component in the respective panels
Use the addTab() method of JTabbedPane to add the
panel
37. Event Handling
Register a ChangeListener
Handle stateChanged() method
39. Constructing a JSplitPane
public JSplitPane()
public JSplitPane(int orientation)
public JSplitPane(int, boolean)
public JSplitPane(int, boolean, Component,
Component)