Wikipedia

Search results

Monday, April 1, 2019

CardLayout in java

Home 
  • Cardlayout in java :-
A CardLayout object is a layout manager for a container. It treats each component in the container as a card. Only one card is visible at a time.. The first component added to a CardLayout object is the visible component when the container is first displayed.

  • Constructors of CardLayout :-
1.public CardLayout()


Creates a new card layout with gaps of size zero. 

2.CardLayout(int hgap, int vgap)
Creates a new card layout with the specified horizontal and vertical gaps.

Some of the methods of  CardLayout are:-




Methods




Description
public  first(Container parent)Shows the first card of the parent container
public next(Container parent)Shows the next card of the parent containerIf the current visible card is the last one, it will flip to the first one.
public previous(Container parent)Shows to the previous card of the parent container. If the current visible card is the first one, it will flip to the last one.
public  last(Container parent)Show the last card of the parent container.
public  show(Container parent,String name)Show the card with a given name.

No comments:

Post a Comment