• Post Reply Bookmark Topic Watch Topic
  • New Topic

Swing Tutorial Book - layout managers

 
Michael Cleary
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Last fall while working on some small class projects I used several different layout managers, but found them somewhat restrictive with respect to what I wanted to do. I noticed in the TOC of the book that you apparently can create customized layout managers. I was unaware of this and was wondering what sort of limitations there might be imposed in creating your own layout manager.
Thanks,
Mike
 
Kathy Walrath
Author
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone can write or use any custom layout manager, though sometimes it takes a bit of doing to make it work right. You just need to write a class that implements LayoutManager interface (or, optionally, its subinterface LayoutManager2). This page has more information, along with two examples of custom layout managers:
http://java.sun.com/docs/books/tutorial/uiswing/layout/custom.html
 
bas duijzings
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To give credit to the book, these things are covered. However from experience i have to say that the normal layoutmanagers suffice. Maybe take a look at your design and try to use the standard ones in java. That will be easier maintenance (for others) than creating your own.
 
Michael Cleary
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks all!
While it may be harder to maintain if you write your own, if there are specific things you want to do with the layout, it seems like the only way to go.
Thanks,
Mike
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!