posted 23 years ago
I have a litle confused concerning the CardLayout manager. Many books show code where an anonymous instance to a Layout Manager is created. For example suppose F is an instance of a Frame. To set the layout manager to FlowLayout we could write:
setLayout(new FlowLayout());
And I have found some instances where this is done with the CardLayout manager. HOWEVER, since the actual methods for showing the panels belong to the instance of CardLayout and not the container component, writing:
setLayout(new CardLayout());
is entirely self defeating since we wouldn't be able to call the various methods for displaying the "cards", eg. first, prev, next ... etc.
Am I right here, and the books are wrong - or is it (more likely) the other way around?
Thanks in advance
Dan