there is an logical issue to call
panel.removeAll();
instead ofscrollPane.removeAll();
JComponent
are added toJViewport
not to theJScrollPane
then to call (after all Items are added to
JPanel
)panel.revalidate()
andpanel.repaint()
as last code lines in the voidyou have an issue with Concurency in Swing, all updates to already visible
Swing GUI
must be done onEvent Dispatch Thread
, but in other handspanel.repaint()
notifiedEvent Dispatch Thread
and correctly
- use
JList
(non_editable) orJTable
(can be editable) with one column (maybe to removeJTableHeader
) instead ofJPanel
with bunch ofJCheckBoxes
and with un_natural scrolling, note there is storedBoolean
value in the model, that representingJCheckBox
in the view