View Single Post
  #1 (permalink)  
Old 06-07-2008, 08:43 PM
adeeb adeeb is offline
Member
 
Join Date: May 2008
Posts: 29
adeeb is on a distinguished road
Regarding CardLayout
Hi
I know that in card layout we can add different cards and switch between them.
Now i have add buttons as first, last, next and previous. And i am able to do so by using this buttons.Now what i need is to get a card directly on clicking a button say xyz. Imagine you have 15 cards and you need to get the 7th card on clicking the xyz button how to do it. Please some body help me.
The code i used for first and last button is as follows for card layout with 4 cards.


This is for first button

firstb.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent arg0)
{
cl.first(panel);
currcard=1;
}
});

This is for last button

firstb.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent arg0)
{
cl.last(panel);
currcard=4;
}
});
Reply With Quote
Sponsored Links