Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Positioning components

 
Brett Thomas
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all. I've read a couple of beginner books on Java - but I'm still a novice. After writing several programs contained in the books, I decided to tackle converting a very simple VB6 program into a Java applet that I can embed in a web page on my server. The VB6 program is something I wrote for a buddy several years ago. I included a screen shot of it. The user inputs two parameters, clicks the Accept button, and the program fills out the bottom 15 labels with numbers. Each number has a slightly different, short description under it. I changed the captions and such, but it has the look & feel I'm trying to duplicate in my applet. I'm having a very hard time figuring out how to position those objects in my applet to look similar to the VB6 program. I'd love some general tips on how I should go about tackling this (e.g. which layout managers I should use, if I should use two JPanels, if I should use layout managers within the panels, etc.).

Thanks for any help!
Brett
screen.jpg
[Thumbnail for screen.jpg]
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you should be using a layout manager. I shall move this discussion to our GUIs forum.
 
Rob Camick
Ranch Hand
Posts: 2564
9
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Start with the Swing tutorial on Layout Managers to become familiar with the different layouts and their features.

Then you would likely combine multiple panels with multiple layout managers to get the desired effects.

For example maybe for the top you have a BoxLayout or a GridBagLayout to display multiple panels vertically. Then for each row you create a panel with a FlowLayout and add your components to then.

For the bottom half the same idea. Pick a layout to align multiple panels vertically. Then maybe you have a panel with a GridLayout for your combination of text fields and labels.

You can only learn by experimenting.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic