This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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: 24189

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]
Have you checked out Aspose?
subject: confused
jQuery in Action, 3rd edition