title: Controlling one JFrame from another jframe while opening third jframe in java
body: <p>I have 3 different JFrames. One <code>Jframe</code> is a login page another has <code>progressbar</code> and the third one is main page. Now what i want is that when we login in I want to show <code>progressbar</code> above login page and on completing progress to 100% I want to close both frames and open third <code>Jframe</code> which is main page. please kindly help me get this done.
  Thanks
  //here is the code part.</p>
  
  <pre><code>rs=pstmt.executeQuery();
      if(rs.next()){
      progressbar prb=new progressbar(user);
      prb.setVisible(true);
  </code></pre>
  
  <p>}// this open my 2nd JFrame of progress bar</p>
  
  <p>//next in Progressbar page i have this code</p>
  
  <pre><code>`public progressbar(String user) {
      initComponents();
      setLocationRelativeTo(null);
      t = new Timer(35, (ActionEvent e) -&gt; {
          count++;
          pb.setValue(count);
          if(pb.getValue()&lt;100){
              pb.setValue(pb.getValue() + 1); // it makes bar progress
          }
  // after progress is 100%
          if(pb.getValue()== 100){
              t.stop();
              this.dispose(); 
              Mainpage mp=new Mainpage(user);
              mp.setVisible(true); // this opens my Mainpage
          }
      });
      t.start();
  }
  </code></pre>
  
  <p>// Now what I want is after progress bar completes, I want to dispose both the login page and progress bar page opening Main page only</p>