i want to add Jdialog before frameview...my frameview consist of my main page of application. i just want to add Jdialog which get password from user and then ent
MyMainPanel mainPanel = new MyMainPanel();
LoginPanel loginPanel = new LoginPanel();
JFrame mainApp = new JFrame();
mainApp.add( mainPanel );
mainApp.pack();
mainApp.setVisible(true);
JDialog dialog = new JDialog( mainApp, true );
dialog.add( loginPanel );
dialog.setVisible( true );
if( login.isAuthenticated() ) { // after dialog is dismissed we can set the user
mainPanel.setAuthenticatedUser( loginPanel.getAuthenticatedUser() );
} else {
System.exit(-1);
}
That will show a dialog in front of your main panel and the user won't be able to use it until they login because its modal, and your LoginPanel can force the user to login by not offering any other option but Login, Signup, etc.