title: The method setVisible(boolean) is undefined for the type orbital_app
body: <ol>
  <li><p>This is the code. My main frame is orbital_app and I would like it to when I click on JButton (button), data is being saved, the current window closes and another window orbital_app opens.</p>
  
  <pre><code>public class signup_try {
  
      private JFrame frame;
      private JTextField txtname;
      private JTextField textusername;
      private JTextField txtpass;
      private JTextField textmail;
  
      /**
       * Launch the application.
       */
      public static void main(String[] args) {
          EventQueue.invokeLater(new Runnable() {
              public void run() {
                  try {
                      signup_try window = new signup_try();
                      window.frame.setVisible(true);
                  } catch (Exception e) {
                      e.printStackTrace();
                  }
              }
          });
      }
  
      /**
       * Create the application.
       */
      public signup_try() {
          initialize();
      }
  
      Connection connection=null;
  
      /**
       * Initialize the contents of the frame.
       */
      private void initialize() {
  
          connection=dbase.dBase();
          frame = new JFrame();
          frame.setBounds(100, 100, 450, 300);
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.getContentPane().setLayout(null);
  
          JLabel label = new JLabel("Orbital");
          label.setForeground(SystemColor.activeCaption);
          label.setFont(new Font("Arial Black", Font.BOLD, 17));
          label.setBounds(170, 11, 71, 25);
          frame.getContentPane().add(label);
  
          JLabel label_1 = new JLabel("Name:");
          label_1.setForeground(SystemColor.activeCaption);
          label_1.setFont(new Font("Arial Black", Font.PLAIN, 12));
          label_1.setBounds(21, 66, 46, 14);
          frame.getContentPane().add(label_1);
  
          txtname = new JTextField();
          txtname.setColumns(10);
          txtname.setBounds(102, 63, 200, 22);
          frame.getContentPane().add(txtname);
  
          textusername = new JTextField();
          textusername.setColumns(10);
          textusername.setBounds(102, 108, 200, 22);
          frame.getContentPane().add(textusername);
  
          txtpass = new JTextField();
          txtpass.setColumns(10);
          txtpass.setBounds(102, 150, 200, 22);
          frame.getContentPane().add(txtpass);
  
          textmail = new JTextField();
          textmail.setColumns(10);
          textmail.setBounds(102, 192, 200, 22);
          frame.getContentPane().add(textmail);
  
          JLabel label_2 = new JLabel("Username:");
          label_2.setForeground(SystemColor.activeCaption);
          label_2.setFont(new Font("Arial Black", Font.PLAIN, 12));
          label_2.setBounds(21, 111, 71, 14);
          frame.getContentPane().add(label_2);
  
          JLabel label_3 = new JLabel("Password:");
          label_3.setForeground(SystemColor.activeCaption);
          label_3.setFont(new Font("Arial Black", Font.PLAIN, 12));
          label_3.setBounds(21, 154, 71, 14);
          frame.getContentPane().add(label_3);
  
          JLabel label_4 = new JLabel("Email:");
          label_4.setForeground(SystemColor.activeCaption);
          label_4.setFont(new Font("Arial Black", Font.PLAIN, 12));
          label_4.setBounds(21, 196, 46, 14);
          frame.getContentPane().add(label_4);
  
          JButton button = new JButton("Sign Up");
          button.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent arg0) {
  
  try {
  
                      String query="insert into Users(Name, Username, Password, Email) values(?,?,?,?)";
                      PreparedStatement prepstat=connection.prepareStatement(query);
                      prepstat.setString(1, txtname.getText());
                      prepstat.setString(2, textusername.getText());
                      prepstat.setString(3, txtpass.getText());
                      prepstat.setString(4, textmail.getText());
  
                      prepstat.execute();
  
                      JOptionPane.showMessageDialog(null, "Data saved");
  
  
  
                      prepstat.close();
  
                  } catch (SQLException e) {
                      JOptionPane.showMessageDialog(null, e);
                  }
  </code></pre></li>
  <li><p>I get the error saying that <code>The method setVisible(boolean) is undefined for the type orbital_app</code>. what should I do to fix this? Here I want to close this present frame(signup_try) and go to other frame (orbital_app).. setVisible is underlined red and says <code>"The method setVisible(boolean) is undefined for the type orbital_app"</code>.</p>
  
  <pre><code>                frame.dispose();
                  orbital_app orb=new orbital_app();
                  orb.setVisible(true);
  
  
              }
          });
          button.setBounds(170, 239, 91, 23);
          frame.getContentPane().add(button);
      }
  </code></pre>
  
  <h2>        }</h2></li>
  </ol>
  
  <p>Orbital_app code(in this code setVisible works properly without any error):</p>
  
  <pre><code>package project;
  
  import java.awt.EventQueue;
  
  import javax.swing.JFrame;
  import javax.swing.JLabel;
  import javax.swing.SwingConstants;
  
  import java.awt.Font;
  
  import java.awt.SystemColor;
  
  import javax.swing.JButton;
  import java.awt.event.ActionEvent;
  
  import java.awt.event.ActionListener;
  import java.awt.Color;
  import javax.swing.UIManager;
  
  public class orbital_app{
  
      private JFrame frame;
  
      /**
       * Launch the application.
       */
      public static void main(String[] args) {
          EventQueue.invokeLater(new Runnable() {
              public void run() {
                  try {
                      orbital_app window = new orbital_app();
                      window.frame.setVisible(true);
                  } catch (Exception e) {
                      e.printStackTrace();
                  }
              }
          });
      }
  
  
  
      /**
       * Create the application.
       */
  
  
  
  
      public orbital_app() {
          initialize();
      }
  
      /**
       * Initialize the contents of the frame.
       */
      private void initialize() {
          frame = new JFrame();
          frame.getContentPane().setBackground(UIManager.getColor("Button.background"));
          frame.setResizable(false);
          frame.setBounds(100, 100, 450, 260);
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.getContentPane().setLayout(null);
  
          JLabel toplbl = new JLabel("Orbital");
          toplbl.setForeground(SystemColor.activeCaption);
          toplbl.setFont(new Font("Arial Black", Font.BOLD, 17));
          toplbl.setVerticalAlignment(SwingConstants.TOP);
          toplbl.setBounds(182, 11, 71, 25);
          frame.getContentPane().add(toplbl);
  
          JLabel infolbl = new JLabel("Multipurpose app ==  orbital 1.0\r\n");
          infolbl.setFont(new Font("Arial", Font.PLAIN, 11));
          infolbl.setForeground(SystemColor.activeCaption);
          infolbl.setBounds(138, 47, 165, 25);
          frame.getContentPane().add(infolbl);
  
          JButton signup_btn = new JButton("Sign Up");
          signup_btn.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent arg0) {
                  frame.dispose();
                  signup_form sup_for=new signup_form();
  </code></pre>
  
  <p>3.setVisible works here</p>
  
  <pre><code>                sup_for.setVisible(true);
              }
          });
          signup_btn.setFont(new Font("Arial", Font.PLAIN, 11));
          signup_btn.setForeground(SystemColor.activeCaption);
          signup_btn.setBounds(61, 133, 91, 23);
          frame.getContentPane().add(signup_btn);
  
          JButton signin_btn = new JButton("Sign In");
          signin_btn.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent arg0) {
  
                  frame.dispose();
                  signin_form log_for=new signin_form();
  </code></pre>
  
  <p>4.and here too</p>
  
  <pre><code>                log_for.setVisible(true);
              }
          });
          signin_btn.setFont(new Font("Arial", Font.PLAIN, 11));
          signin_btn.setForeground(SystemColor.activeCaption);
          signin_btn.setBounds(285, 133, 91, 23);
          frame.getContentPane().add(signin_btn);
  
          JLabel notelbl = new JLabel("note: click Sign Up for new account or Sign In for existing account.");
          notelbl.setHorizontalAlignment(SwingConstants.CENTER);
          notelbl.setBounds(10, 199, 406, 25);
          frame.getContentPane().add(notelbl);
      }
  
  
  
  }
  </code></pre>