But can i close first frame when the second opens?
@pritamthing
Жыл бұрын
Yea you can use this.dispose();
@screwdriver3397
Жыл бұрын
@@pritamthing thank you!!!!
@МихаилПолшков-х8м
Жыл бұрын
But how to transform not opening the new window but staying at first
@pritamthing
Жыл бұрын
What is ask here? I don't understand it clearly. 1. If you want first page not to close , then remove this.dispose() else use it
@МихаилПолшков-х8м
Жыл бұрын
@@pritamthing i want not to close the first page. Ok I’ll dispose it and then what do i need to do. I tried to dispose the first panel and then i described the second frame , but it has one big disadvantage: it’s too large code. Pls help me
@pritamthing
Жыл бұрын
@@МихаилПолшков-х8м remove the dispose code and then use new Secondpage().setVisible(true);. Or share your code here
@МихаилПолшков-х8м
Жыл бұрын
@@pritamthing btnNewButton_Soup.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if(e.getSource()==btnNewButton_Soup) { contentPane.removeAll(); revalidate(); repaint(); soup s =new soup(); dispose(); s.Soup(); s.setUndecorated(true); s.setVisible(true); } } }); WHEN i push this button the new window is opening,I don't need this. I just want to change the panel from the first to the secong.If it isn't understadably for you, just ask.
@pritamthing
Жыл бұрын
@@МихаилПолшков-х8м here you you disposing the current i.e first frame and calling second frame and you are getting the new frame. If you just want to switch the panel in the same frame. Just create and use hidden props alternatively
Пікірлер: 12