
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.
for example
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);

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.