KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > webman > wminstaller > app > CardsPanel


1 package de.webman.wminstaller.app;
2
3 import javax.swing.*;
4 import java.awt.*;
5 import java.util.HashMap JavaDoc;
6
7 /**
8  *
9  *
10  * @author <a HREF="mailto:ulf@webman.de">Ulf Goldammer</a>
11  * @version $Revision: 1.2 $
12  **/

13 class CardsPanel
14     extends JPanel
15 {
16     /* $Id: CardsPanel.java,v 1.2 2002/02/11 18:23:17 gregor Exp $ */
17     Installer wmi;
18     CardLayout cl = new CardLayout( 20, 20);
19     HashMap JavaDoc elements = new HashMap JavaDoc();
20
21     public CardsPanel(Installer wmi) {
22         this.wmi = wmi;
23         this.setLayout(cl);
24     }
25     
26     public CardLayout getCardLayout() {
27         return cl;
28     }
29     
30     public void showCard( int c) {
31         cl.show(this, "" + c);
32     }
33
34     public Component addCard(Component com, int idx) {
35         String JavaDoc key = "" + idx;
36         elements.put(key, com);
37         System.out.println("----> added: " + idx);
38         super.add(com, key);
39         return com;
40     }
41
42     public Component getCard(int idx) {
43         return (Component) elements.get("" + idx);
44     }
45 }
46
47
48
Popular Tags