File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Layout

 
Dean Kiely
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do i go about having 3 panels ontop of a main panel and inside each of these panels i have 2 buttons on the left hand side and a canvas on the remaining part of the panel.
I am finding this tricky as the BorderLayout is very limited i.e north south east or west etc are the only choices available. How do i get around this??
Many thanks.
DK
 
Joe Ess
Bartender
Posts: 9214
9
Linux Mac OS X Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will probably have to use a combination of layout managers. Look at the Java Tutorial's section on Swing, specifically Laying Out Components.
 
Dean Kiely
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I originally had one canvas but now i would like to have 3 panels and to have a canvas on each, is this possible or can i only have one canvas?
Thanks.
 
Rosie Vogel
Ranch Hand
Posts: 229
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is certainly possible, you can add a Canvas to your Applet and Panels to your Canvas and then add Buttons to the Panels, etc., etc., making a nested structure. Personally I like to use GridBagLayout to layout Applets. It's kind of comparable to using tables in HTML: every Component has it's own "cell" and you can have some Components stretch across more than one cell if you like. You can read more about it here:
http://java.sun.com/docs/books/tutorial/uiswing/layout/gridbag.html
 
Dean Kiely
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was told that I could not add jpanels to a canvas, so instead I created a main Jpanel and added 3 jpanels to it, then i want to create a canvas in each jpanel, is this possible?? I had one main canvas but now i want to break it up to put different parts on each of the 3 jpanels.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic