public boolean changeSubScreen ( Container parent , JBasePanel baseScreen , String strCommandToPush , int options ) { if ( ( parent == null ) || ( parent == this ) ) parent = m_parent ; boolean bScreenChange = false ; if ( ! this . checkSecurity ( baseScreen ) ) { baseScreen . free ( ) ; return false ; } this . freeSubComponents ( parent ) ; if ( parent . getComponentCount ( ) > 0 ) { // Remove all the old components parent . removeAll ( ) ; bScreenChange = true ; } JComponent screen = baseScreen ; if ( ! ( parent . getLayout ( ) instanceof BoxLayout ) ) parent . setLayout ( new BorderLayout ( ) ) ; // If default layout, use box layout! screen = baseScreen . setupNewScreen ( baseScreen ) ; screen . setMinimumSize ( new Dimension ( 100 , 100 ) ) ; screen . setAlignmentX ( LEFT_ALIGNMENT ) ; screen . setAlignmentY ( TOP_ALIGNMENT ) ; parent . add ( screen ) ; if ( bScreenChange ) { this . invalidate ( ) ; this . validate ( ) ; this . repaint ( ) ; baseScreen . resetFocus ( ) ; } if ( parent == m_parent ) { if ( strCommandToPush == null ) strCommandToPush = baseScreen . getScreenCommand ( ) ; if ( strCommandToPush != null ) if ( ( options & Constants . DONT_PUSH_HISTORY ) == 0 ) this . pushHistory ( strCommandToPush , ( ( options & Constants . DONT_PUSH_TO_BROWSER ) == Constants . PUSH_TO_BROWSER ) ) ; } return true ; // Success }
Change the sub - screen .