+ 3
what's the difference between Jpanel and Jframe
4 Respuestas
+ 1
JFrame - Used to represent the stuff a window should have. This includes borders (resizeable y/n?), titlebar (App name or other message), controls (minimize/maximize allowed?), and event handlers for various system events like 'window close' (permit app to exit yet?).
JPanel - Generic class used to gather other elements together. This is more important with working with the visual layout or one of the provided layout managers e.g. gridbaglayout, etc. For example, you have a textbox that is bigger then the area you have reserved. Put the textbox in a scrolling pane and put that pane into a JPanel. Then when you place the JPanel, it will be more manageable in terms of layout.
0
Jframe provides the basic attributes and behaviours of a window.Whereas, Jpanel is a supporting container that cannot be displayed on its own but must be added to another container.
0
JPanel is added to JFrame, jframe cannot be added to jpanel, jframe can be displayed without panel, jpanel cannot be displayed without jframe, default layout for jpanel is flowlayout while for jframe is border layout, jframe can have jmenubar, jpanel doesnt have menubars
0
JFRAME==PHOTO FRAME
JPANEL==PHOTO