public boolean checkSecurity ( JBasePanel baseScreen ) { if ( ( this . getApplication ( ) == null ) || ( baseScreen == null ) ) return true ; // Never int iErrorCode = baseScreen . checkSecurity ( this . getApplication ( ) ) ; if ( iErrorCode == Constants . READ_ACCESS ) { int iLevel = Constants . LOGIN_USER ; try { iLevel = Integer . parseInt ( this . getProperty ( Params . SECURITY_LEVEL ) ) ; // This is my current login level } catch ( NumberFormatException ex ) { } if ( iLevel == Constants . LOGIN_USER ) iErrorCode = Constants . AUTHENTICATION_REQUIRED ; // For now, thin security is manual (No read access control) else if ( iLevel == Constants . LOGIN_AUTHENTICATED ) iErrorCode = Constants . ACCESS_DENIED ; // If they only are allowed read access, don't let them access this screen (for now) } if ( iErrorCode == Constants . NORMAL_RETURN ) return true ; // Success if ( iErrorCode == Constants . ACCESS_DENIED ) { String strMessage = this . getApplication ( ) . getSecurityErrorText ( iErrorCode ) ; JOptionPane . showConfirmDialog ( this , strMessage , strMessage , JOptionPane . OK_CANCEL_OPTION ) ; return false ; } String strDisplay = null ; if ( ( iErrorCode == Constants . LOGIN_REQUIRED ) || ( iErrorCode == Constants . AUTHENTICATION_REQUIRED ) ) { iErrorCode = onLogonDialog ( ) ; if ( iErrorCode == JOptionPane . CANCEL_OPTION ) return false ; // User clicked the cancel button if ( iErrorCode == Constants . NORMAL_RETURN ) return true ; // Success strDisplay = this . getLastError ( iErrorCode ) ; } else strDisplay = this . getLastError ( iErrorCode ) ; // Display the error message and return! JOptionPane . showConfirmDialog ( this , strDisplay , "Error" , JOptionPane . OK_CANCEL_OPTION ) ; return false ; // Not successful }
This is just for convenience . A simple way to change or set the screen for this applet . The old screen is removed and the new screen is added . This method is also used to switch a sub - screen to a new sub - screen .