How do I exit a particular frame based on a simulation on a JPanel within that particular frame without exiting entire application?
In my main class I have a Frame() method
public void FightFrame(String offensemsg){      
    JFrame frame = new JFrame("BattleView: ");
    frame.setLayout(new BorderLayout());
    FightScene sc = new FightScene();       
    frame.add(sc);
    frame.setVisible(true);
    frame.setSize(652, 480);
    frame.setLocationRelativeTo(null);
    frame.setResizable(false);
    sc.GenerateScene(offensemsg);
}
in my FightScene class, I am drawing out a fightscene, the class also has checkCollision() method
      public void checkCollisions() {
           for (int i = 0; i < defense.size(); i++) {
                FriendlyEntity m = (FriendlyEntity) defense.get(i);    
                Rectangle r1 = m.getBounds();    
                for (int j = 0; j<offense.size(); j++) {
                    Enemy a = (Enemy) offense.get(j);
                    Rectangle r2 = a.getBounds();    
                    if (r1.intersects(r2)) {
                        m.setHealth(-1);
                        a.setHealth(-1);
                        if(a.getHealth()==0){
                        a.setVisible(false);
                        } else if(m.getHealth()==0){
                            m.setVisible(false);
                            }                       
                }}
           }               
           if(defense.size()==0){                   
                System.out.println("You have lost the battle\n");
                //############ How can I exit the FightFrame from here?
            }else if (offense.size()==0){
                System.out.println("You have won the battle\n");
            //############# How can I exit the FightFrame from here?                    
            }
        }
 
     
     
    