How are Swing components internally created, laid out, repainted, notified of events, ...?

I wonder if there is good documentation (or a (viewable) book) on the life cycle of Swing components .

Is the "life cycle" the right term?

I hope to find answers to the question, for example:

  • How, when, in what order are the drawing methods called ?
  • How, when, what events are triggered by whom?
  • What is the sequence method calls to create components?

From time to time I come across unusual behavior of my applications, for example:

  • The ComponentListener resize event is fired before setVisible (true)
    (so the root panel has negative dimensions!)
  • Some components are correctly decomposed only after manually resizing the JFrame
  • Changing a superclass from JPanel to JLayeredPane calls my class, which should be laid out differently inside another container.
  • And many other strange things ...
+5
source share
1 answer

I had the same question a long time ago.

I can’t believe how difficult it is to find a good resource on this topic on the Internet.

, , .:)

Swing

, , , .

, .

+2

All Articles