• Post Reply Bookmark Topic Watch Topic
  • New Topic

Adding GridLayout to JDesktopPane as well as a BorderLayout?  RSS feed

 
Josh Rodrigues
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So far I have a JDesktopPane for an Operating System I am making in Java that uses a BorderLayout for a JTaskBar I made. I was thinking of using a GridLayout to make the icons and whatnot on the desktop have positioning and not be all over the place. But, if I put in a GridLayout, then the JTaskBar will be on the top responding to the GridLayout instead of the BorderLayout.SOUTH. Should I use a different way to make the desktop show icons without the GridLayout?
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not use both? Have a JPanel that uses GridLayout hold the icons, and then place this JPanel into the BorderLayout.SOUTH position of another JPanel that uses BorderLayout. This way you can have the best of both worlds.
 
Josh Rodrigues
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried using both but the GridLayout panel seems off. I'm trying to make 13 rows and 17 columns for the JDesktopPane to use, but when I create a little icon of a folder, it will just center itself along with adding in a recycle bin icon.
http://img44.imageshack.us/img44/6554/desktopat.png
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read the API for JDesktopPane. You're misusung it. Just use a JPanel instead.

For better help sooner, post a SSCCE.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!