0

How can I minimize a JFrame if I am in another JPanel that I add to this JFrame? Here I add the JPanel that is in another class to the JFrame:

panel = new Panel_Processos("Caixa de Saída", 3);
setContent(pane, panel);

public void setContent(JPanel pane, JPanel panel){
    pane.removeAll();
    pane.setVisible(true);
    pane.validate();
    pane.add(panel);
    contentPane.validate();
}

But the problem is: How can I do something to the JFrame after an event that happens in the JPanel?

A. Sousa
  • 13
  • 1
  • 4
  • 1
    You can minimize a `JFrame` by calling `frame.setState(Frame.ICONIFIED)` as stated by [this answer](http://stackoverflow.com/a/3965353/4475997) and if you don't have an instance of your `JFrame`, you can use `(JFrame) SwingUtilities.getWindowAncestor(yourJPanelHere)` as stated by [this answer](http://stackoverflow.com/a/9650915/4475997). – MasterBlaster Jul 31 '16 at 17:29
  • Thank you! It worked very well :D – A. Sousa Jul 31 '16 at 18:03

0 Answers0