Difference between JPanel, JFrame, JComponent, and JApplet

后端 未结 3 1913
你的背包
你的背包 2021-01-30 01:52

I\'m making a physics simulator for fun and I was looking up graphics tutorials when I tried to figure out the difference between all these J\'s. Can somebody elaborate on them

3条回答
  •  情歌与酒
    2021-01-30 02:18

    You might find it useful to lookup the classes on oracle. Eg:

    http://download.oracle.com/javase/1.4.2/docs/api/javax/swing/JFrame.html

    There you can see that JFrame extends JComponent and JContainer.

    JComponent is a a basic object that can be drawn, JContainer extends this so that you can add components to it. JPanel and JFrame both extend JComponent as you can add things to them. JFrame provides a window, whereas JPanel is just a panel that goes inside a window. If that makes sense.

提交回复
热议问题