• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

java awt questions

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

dropadrop

Member
Joined
Mar 17, 2001
Location
Finland
What would be the easiest way to create "navigation pages" in a simple java program using awt for the graphical interface. The rest of the program is easy enough, but I have'nt bumped into any reference that would give advice on how to do this.

page1.gif

page2.gif


So the only question is, how to create tabs with awt. (not swing)
 
Last edited:
You know you would be saving yourself a lot of trouble by using AWT :(

But here is a bit of a hackish solution I used once back in my VB days before I discovered tabbed panes (slight modifications for Java though).

First use a BorderLayout on the main panel, and nest a FlowLayout panel on the top, and a CardLayout in the center. (There may be a bit of fiddling with setting involved to get everything looking neat and tidy)

Now put your nav buttons in the top container and your panels in the CardLayout (check the Java documentation under java.awt.CardLayout for details I can't remember them offhand)

Now using a few if or case statements link the pressing of the buttons to the visibility of the panels and you should be good to go -:D ;)

(P.S. This is just off the top of my head so I may have missed something, but I promise I will test it out a bit later to see if there are any problems and maybe post some proper code if needed)
 
Back