I tried it but at the compile time it throwed IllegalArgumentException.
my code is....
import javax.swing.*; import javax.swing.event.*; import java.awt.*; public class cards extends JFrame { JPanel p1,p2,cards; JLabel l1,l2; JButton b1,b2; public cards() { //super("card1"); setDefaultCloseOperation(EXIT_ON_CLOSE); setLayout(new CardLayout()); l1=new JLabel("card1...."); l2=new JLabel("card2...."); b1=new JButton("b1...."); b2=new JButton("b2...."); p1=new JPanel(new FlowLayout()); p2=new JPanel(new FlowLayout()); p1.add(l1); p1.add(b1); p2.add(l2); p2.add(b2); add(p1); add(p2); } public static void main(String[] args) { cards c=new cards(); c.setSize(300,300); c.setVisible(true); } }
i m jst a beginner!!!!!!!!!!!