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.
I think that you're looking at using the show( ) method of the CardLayout, which you can find in the API here.
It takes two parameters, the first being the name of the component that is implementing the CardLayout which for you appears to be the "panel" object, and the second parameter is a String which matches the String used when you inserted your desired card component onto panel. The trick here is to retrieve this String, and that will depend on your program. One way is to create a simple array or arraylist to hold these Strings and simply retrieve the seventh item in the ArrayList (or array). [ June 07, 2008: Message edited by: pete stein ]
posted 11 years ago
Hi, Thanks for your help its working now. But i have one more problem. I want to add a image to a panel which can cover upto 75% of its length. I already have some text fields above. I want to add image on same panel but below the text fields. So please any body can help.
Originally posted by adeeb alexander: ..But i have one more problem.
Would you please start a new thread for every new topic? Usually people scroll through the thread list, reading the subject line for topics of interest. Having multiple topics in the same thread makes it difficult for them. [ June 09, 2008: Message edited by: Maneesh Godbole ]