-1

I will try to be really specific with my question.So I have an application in a JFrame which contains 3 buttons and each of them open another JFrame and they are doing some animation inside.So what i have to do is close just one frame but not the main frame with it.And in this 3 frames there is SwingWorker who is processing some data,so when I close specific frame I want this application to stop and not doing in a background.

Jan
  • 55
  • 1
  • 6

1 Answers1

1

You can add an actionListerner on the click of the button..Once the button is clicked you set the visibility of a specific frame to false the user the dispose function on that specific frame and cancel its background activities

like below

cancelbtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            frame1.setVisible(false);
            frame1.dispose();
Bradley Juma
  • 131
  • 13