Note that there are some explanatory texts on larger screens.

plurals
  1. POChange JPanel after press JButton
    text
    copied!<p>i want to change JPanels by pressing the JButton. Well i can do that one time , but the problem is when i want to back to the previous JPanel . Here is my code:</p> <pre><code>public class MindCreations { public static void main(String[] args){ Adj0 object1= new Adj0(); object1.setSize(500, 600); object1.setVisible(true); object1.setLocation(700,300); } } public class Adj0 extends JFrame{ public Adj0(){ super("MindCreations"); this.setLayout(null); adj0panel object9=new adj0panel(); add(object9.adj0panel()); Isa object10=new Isa(); add(object10.Isa()); } } public class adj0panel { private JButton quarto; private FlowLayout layout; public JPanel adj0panel(){ final JPanel panel=new JPanel(); JLabel jl=new JLabel(); panel.setLayout(layout); quarto= new JButton("Tabela ISA"); quarto.setBounds(50,490,400,20); jl.setIcon(new ImageIcon("2.png")); jl.setBounds(40, 50, 413, 300); panel.add(jl); panel.add(quarto); quarto.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent event){ Isa object3=new Isa(); panel.setVisible(false); } }); return panel; } } public class Isa { public JPanel Isa(){ final JPanel panel1=new JPanel(); panel1.setLayout(layout); panel1.setBounds(0, 0, 500, 600); panel1.setBackground(Color.WHITE); panel1.setVisible(true); JButton retroceder=new JButton("Retroceder"); retroceder.setBounds(300, 460, 90, 20); retroceder.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent event){ adj0panel object4=new adj0panel(); panel1.setVisible(false); }} ); panel1.add(retroceder); return panel1; }} </code></pre> <p>I want to press the Button "retroceder" , and i want to go to JPanel from adj0panel class. Sorry for the long question , i'm a begginer in this . If is there any other way to change JPanels please tell me . thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload