im wondering how a jcomponent gets painted on the screen, is it painted inside paintComponent() from Graphics? Or is it painted separately. Im asking this because its weird how a jbutton changes color on mousehover even though repaint() is never called.
Thanks for your time.
Components are painted with theirpaintmethod.repaintis just a useful method that will callpaintat some point in the near future on the Event Dispatch Thread.When the mouse enters a
JButton, the following method is called (forJButtons with a default UI):ButtonModel.setRolloverwill fire aChangeEvent, which is handled byAbstractButtonin the following way:So
repaintis called when the mouse enters aJButton.