i have two panels added one below anotehr. and i have a one button. when i clicked button. the first panel ara should be overlapped with second panel. i mean second panel size should cover both paenls size using gribaglayout or any layout. need quick reply.
thanks in advance.
hi friend, To align the panels you would have to set size manually or you can use java.awt.Insets to set the preferred size and to overlap the panels you can use javax.swing.JLayeredPane class.
JLayeredPane layeredPane = new JLayeredPane(); layeredPane.setBounds(0, 0, 600, 400); Frame frame = new JFrame(); frame.add(layeredPane, BorderLayout.CENTER); JPanel panel = new JPanel(); panel.setBounds(50, 10, 150, 150); layeredPane.add(panel, new Integer(0), 0);
Go through the link Roseindia Tutorial
this may helpful for you.