+ 3

what's the difference between Jpanel and Jframe

25th Sep 2016, 12:33 PM
jerry
jerry - avatar
4 Respostas
+ 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.
26th Sep 2016, 11:59 AM
Oliver Brown
Oliver Brown - avatar
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.
25th Sep 2016, 1:40 PM
Hemant Jaiswal
Hemant Jaiswal - avatar
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
25th Sep 2016, 5:49 PM
Sijan Maharjan
Sijan Maharjan - avatar
0
JFRAME==PHOTO FRAME JPANEL==PHOTO
21st Apr 2017, 2:15 AM
Yash Tiwari
Yash Tiwari - avatar