question: protected boolean removeLevelXing ( LevelXing o ) { if ( ! noWarnLevelXing ) { int selectedValue = JOptionPane . showOptionDialog ( this , rb . getString ( "Question3r" ) , Bundle . getMessage ( "WarningTitle" ) , JOptionPane . YES_NO_CANCEL_OPTION , JOptionPane . QUESTION_MESSAGE , null , new Object [ ] { Bundle . getMessage ( "ButtonYes" ) , Bundle . getMessage ( "ButtonNo" ) , rb . getString ( "ButtonYesPlus" ) } , Bundle . getMessage ( "ButtonNo" ) ) ; if ( selectedValue == 1 ) { return ( false ) ; } if ( selectedValue == 2 ) { noWarnLevelXing = true ; } } if ( selectedObject == o ) { selectedObject = null ; } if ( prevSelectedObject == o ) { prevSelectedObject = null ; } TrackSegment t = ( TrackSegment ) o . getConnectA ( ) ; if ( t != null ) { substituteAnchor ( o . getCoordsA ( ) , o , t ) ; } t = ( TrackSegment ) o . getConnectB ( ) ; if ( t != null ) { substituteAnchor ( o . getCoordsB ( ) , o , t ) ; } t = ( TrackSegment ) o . getConnectC ( ) ; if ( t != null ) { substituteAnchor ( o . getCoordsC ( ) , o , t ) ; } t = ( TrackSegment ) o . getConnectD ( ) ; if ( t != null ) { substituteAnchor ( o . getCoordsD ( ) , o , t ) ; } LayoutBlock lb = o . getLayoutBlockAC ( ) ; if ( lb != null ) { lb . decrementUse ( ) ; } LayoutBlock lbx = o . getLayoutBlockBD ( ) ; if ( lbx != null && lb != null && lbx != lb ) { lb . decrementUse ( ) ; } for ( int i = 0 ; i < xingList . size ( ) ; i ++ ) { LevelXing lx = xingList . get ( i ) ; if ( lx == o ) { xingList . remove ( i ) ; o . remove ( ) ; setDirty ( true ) ; repaint ( ) ; return ( true ) ; } } return ( false ) ; }
target:  Remove a Level Crossing