| Author |
Difference between JFrame and JPanel
|
abrar alvi
Ranch Hand
Joined: Feb 01, 2012
Posts: 66
|
|
|
I would like to know the differences between JFrame and JPanel
|
 |
Nam Ha Minh
Ranch Hand
Joined: Oct 31, 2011
Posts: 364
|
|
abrar alvi wrote:I would like to know the differences between JFrame and JPanel
JFrame is a window, whereas JPanel is just a lightweight container.
|
Job Offer: Online working Java technical writing
|
 |
abrar alvi
Ranch Hand
Joined: Feb 01, 2012
Posts: 66
|
|
Nam Ha Minh wrote:
abrar alvi wrote:I would like to know the differences between JFrame and JPanel
JFrame is a window, whereas JPanel is just a lightweight container.
Can i get some example program to understand it better or some good article links.
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16487
|
|
|
Sure. You'll find those example programs in the tutorial. And you can find the tutorial by going to the API documentation for the two classes and following the links there.
|
 |
Randall Twede
Ranch Hand
Joined: Oct 21, 2000
Posts: 4095
|
|
among other things JFrame does not inherit any swing stuff so it has no paintComponent() method like a JPanel.
IMO it is misnamed
|
SCJP
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19232
|
|
|
I disagree. It's no descendant of JComponent, but that's the only thing that would make it "not Swing", according to you. However, JComponent itself extends Container which extends Component, so both JFrame and JComponent have their roots in AWT. Also, JFrame uses several Swing components (JRootPane, JLayeredPane, JPanel for its content pane) for displaying the actual contents.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: Difference between JFrame and JPanel
|
|
|