Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9242461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:35:01+00:00 2026-06-18T08:35:01+00:00

I am using Netbeans 7.3 Beta 2 GUI builder. Coding a Swing GUI and

  • 0

I am using Netbeans 7.3 Beta 2 GUI builder. Coding a Swing GUI and I am trying to show another GUI once a button has been pressed.

private void loginButtonSceneActionPerformed(java.awt.event.ActionEvent evt) {
    new LoginGUI();
}

Once login button is pressed I want to show the LoginGUI but it does nothing and Netbeans states “New instance ignored”. I’ve added a system.out.println on the button to make sure it works fine and it does.

Here is more or less the full source. Where am I going wrong? I want to replace this GUI with the login GUI.

package com.john.spp.view;
import java.sql.ResultSet;
import java.sql.Statement;

/**
 *
 * @author John
 */
public class LogRegGUI extends javax.swing.JFrame {

/**
 * Creates new form LoginGUI
 */
public LogRegGUI() {
    initComponents();
}

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
   //GUI BUILDER CODE HERE
}// </editor-fold>

private void loginButtonSceneActionPerformed(java.awt.event.ActionEvent evt) {
    new LoginGUI();
}

private void registerSceneButtonActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
}

/**
 * @param args the command line arguments
 */
public static void main(String args[]) {
    /* Set the Nimbus look and feel */
    //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
    /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
     * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
     */
    try {
        for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                javax.swing.UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (ClassNotFoundException ex) {
        java.util.logging.Logger.getLogger(LogRegGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
        java.util.logging.Logger.getLogger(LogRegGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
        java.util.logging.Logger.getLogger(LogRegGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
        java.util.logging.Logger.getLogger(LogRegGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    }
    //</editor-fold>

    /* Create and display the form */
    java.awt.EventQueue.invokeLater(new Runnable() {
        public void run() {
            new LogRegGUI().setVisible(true);
        }
    });
}
// Variables declaration - do not modify
private javax.swing.JButton dataVaultButton;
private javax.swing.JButton helpButton;
private javax.swing.JEditorPane jEditorPane1;
private javax.swing.JLabel jLabel3;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JButton loginButton;
private javax.swing.JButton logoutButton;
private javax.swing.JButton registerButton;
private javax.swing.JButton settingsButton;
// End of variables declaration
}

Thanks.

EDIT:

Fixed it by using this code, but it looks quite bad as it flashes quite quickly and re-draws the new GUI, any ideas on how to stop this?

private void loginButtonSceneActionPerformed(java.awt.event.ActionEvent evt) { 
    LoginGUI itemloader=new LoginGUI();
    itemloader.setVisible(true);
    this.setVisible(false);
} 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T08:35:02+00:00Added an answer on June 18, 2026 at 8:35 am

    There’re several causes why using multiple frames isn’t the best solution for applications. Well, it often leaves a confused user and as you see brings several complications.
    As I already suggested at the comments you could let you guide by my other answer yesterday by constructing all your JFrames before you show them. If you then set them visible, there won’t be so much delay as it is now and also you save some memory and CPU time.
    Another way may be to just use one single frame and change it’s contents. This answer has really grown to my favorite in referencing 😉
    This way there’s also the possibility to construct first and then instantly show what you’ve already build. No delay, no flickering.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im using netbeans gui editor and im trying to add a Jfreechart that is
I have been using netbeans GUI editor for some time now to design a
Im using Netbeans GUI Builder and I am adding a JTree to my form,
When using Netbeans' features for generating event handlers from a GUI, for example, while
I am using NetBeans 6.9 Beta and I would like to accomplish the following:
I'm using netBeans and I'm trying to generate a report unsing Jasper Report Can
I am using Netbeans and am trying to find a way for the IDE
I'm using netbeans 6.7 on windows.I've been using DerbyClient in my spring test project
Using Netbeans 6.9.1 on Ubuntu 10.10 Beta, when I try to create a new
I'm using Netbeans IDE to make a gui application. I have a JFrame with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.