• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

confused

 
Ebunoluwa Adedoye
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello friends,
dnt know the actual use of JPanel
thanks in advance
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic