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!
Joined: Oct 13, 2005
Yes, you should be using a layout manager. I shall move this discussion to our GUIs forum.
Joined: Jun 13, 2009
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.