Meaningless Drivel is fun!
The moose likes Swing / AWT / SWT and the fly likes confused Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "confused" Watch "confused" New topic


Ebunoluwa Adedoye

Joined: Sep 23, 2005
Posts: 15
hello friends,
dnt know the actual use of JPanel
thanks in advance
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

It has two main uses:

1. You can draw pictures on it (by writing a subclass and implementing "paintComponent()"). If you draw on a JPanel, and add the JPanel to one area some larger container like a JFrame, then you can draw on just one area of the larger container.

2. You can use it as a container to hold buttons and other things (by adding it to a JFrame, JScrollPane, JTabbedPane, or other container, and adding the buttons and things to the JPanel.) This kind of "hierarchical" layout lets you achieve all sorts of interesing effects.

I'll move this to our Swing/AWT forum for further discussion.

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: confused
It's not a secret anymore!