Cell Renderers
in Java |
Prof. David Bernstein
|
Computer Science Department |
bernstdh@jmu.edu |
JComboBox
,
JList
, JTable
,
JTree
) can contain
objects of any class but each must be rendered differently
toString()
method and
renders the String
paint()
method that can
be passed an appropriately configured (i.e., with the
correct bounds) Graphics
objectComponent
and its descendantsComponent
:
Component
and implements the
renderer interfaceContainer
:
Container
(e.g., JPanel
),
contains multiple appropriate components using an
appropriate layout, and implements the renderer
interfaceComponent
(e.g., JComponent
),
implements the renderer interface, and
overrides the paint
methodComponent
(cont.)
Container
(cont.)
Component
(cont.)