What is the relation between ContentPane and JPanel?

前端 未结 6 1817
情书的邮戳
情书的邮戳 2020-12-01 02:14

I found one example in which buttons are added to panels (instances of JPanel) then panels are added to the the containers (instances generated by getCont

6条回答
  •  悲&欢浪女
    2020-12-01 02:50

    Good question. I found it helpful to understand that "Swing provides three generally useful top-level container classes: JFrame, JDialog, and JApplet. ... As a convenience, the add method and its variants, remove and setLayout have been overridden to forward to the contentPane as necessary."—Using Top-Level Containers

提交回复
热议问题