Buggy code:
public class JPanelComponent { public BottomGamePanelView bottomGamePanel ; public JButton [ ] [ ] buttons ; public JPanel getGameTowerPanel ( Dimension parentDimension ) { } public JPanel getGameMapPanel ( int width , int height ) { } public JPanel getMapEditorGridPanel ( final MapModel mapModel , E_MapEditorMode mapEditorMode ) { } public JPanel getMapPlayGridPanel ( final MapModel mapModel , Dimension parentDimension , E_MapEditorMode mapEditorMode ) { JPanel panel = new JPanel ( ) ; GridLayout gridLayout = new GridLayout ( mapModel . getMapHeight ( ) , mapModel . getMapWidth ( ) , 0 , 0 ) ; panel . setLayout ( gridLayout ) ; if ( parentDimension != null ) { panel . setPreferredSize ( new Dimension ( parentDimension . width , ( ( ( ( parentDimension . height ) * 3 ) // 4 ) - 10 ) ) ) ; panel . setMaximumSize ( new Dimension ( parentDimension . width , ( ( ( ( parentDimension . height ) * 3 ) // 4 ) - 10 ) ) ) ; panel . setMinimumSize ( new Dimension ( parentDimension . width , ( ( ( ( parentDimension . height ) * 3 ) // 4 ) - 10 ) ) ) ; } <START_BUG> JButton [ ] [ ] b = new JButton [ mapModel . getMapHeight ( ) ] [ mapModel . getMapWidth ( ) ] ; <END_BUG> for ( int i = 0 ; i < ( mapModel . getMapHeight ( ) ) ; i ++ ) { for ( int j = 0 ; j < ( mapModel . getMapWidth ( ) ) ; j ++ ) { b [ i ] [ j ] = new JButton ( ) ; b [ i ] [ j ] . setBorder ( new LineBorder ( Color . green , 0 ) ) ; b [ i ] [ j ] . setPreferredSize ( new Dimension ( 10 , 10 ) ) ; int value = 0 ; int multiple = 0 ; multiple = mapModel . getMapWidth ( ) ; if ( ( i == 0 ) && ( j == 0 ) ) value = 0 ; else value = ( 1 + j ) + ( i * multiple ) ; b [ i ] [ j ] . setName ( ( ( ( ( value + ":" ) + i ) + ":" ) + j ) ) ; { if ( ( mapModel . mapGridSelection [ i ] [ j ] ) == 1 ) { b [ i ] [ j ] . setIcon ( new ImageIcon ( new ImageIcon ( ApplicationStatics . IMAGE_PATH_MAP_ROUTE ) . getImage ( ) . getScaledInstance ( ( ( ( int ) ( parentDimension . getWidth ( ) ) ) // ( mapModel . getMapWidth ( ) ) ) , ( ( ( int ) ( parentDimension . getHeight ( ) ) ) // ( mapModel . getMapHeight ( ) ) ) , Image . SCALE_SMOOTH ) ) ) ; if ( ( ( i >= 0 ) && ( i < ( mapModel . getMapHeight ( ) ) ) ) || ( ( j >= 0 ) && ( j < ( mapModel . getMapWidth ( ) ) ) ) ) { String name = "" ; if ( i != ( ( mapModel . getMapHeight ( ) ) - 1 ) ) { if ( ( ( ( mapModel . mapGridSelection [ ( i + 1 ) ] [ j ] ) != 1 ) && ( ( mapModel . mapGridSelection [ ( i + 1 ) ] [ j ] ) != 2 ) ) && ( ( mapModel . mapGridSelection [ ( i + 1 ) ] [ j ] ) != 3 ) ) { name = ( ( "" + ( i + 1 ) ) + ":" ) + j ; if ( ! ( MAP_PATH_BOUNDARY_BUTTONS_NAME . contains ( name ) ) ) ApplicationStatics . MAP_PATH_BOUNDARY_BUTTONS_NAME += name + "," ; } } if ( i > 0 ) { if ( ( ( ( mapModel . mapGridSelection [ ( i - 1 ) ] [ j ] ) != 1 ) && ( ( mapModel . mapGridSelection [ ( i - 1 ) ] [ j ] ) != 2 ) ) && ( ( mapModel . mapGridSelection [ ( i - 1 ) ] [ j ] ) != 3 ) ) { name = ( ( "" + ( i - 1 ) ) + ":" ) + j ; if ( ! ( MAP_PATH_BOUNDARY_BUTTONS_NAME . contains ( name ) ) ) ApplicationStatics . MAP_PATH_BOUNDARY_BUTTONS_NAME += name + "," ; } } if ( j != ( ( mapModel . getMapWidth ( ) ) - 1 ) ) { if ( ( ( ( mapModel . mapGridSelection [ i ] [ ( j + 1 ) ] ) != 1 ) && ( ( mapModel . mapGridSelection [ i ] [ ( j + 1 ) ] ) != 2 ) ) && ( ( mapModel . mapGridSelection [ i ] [ ( j + 1 ) ] ) != 3 ) ) { name = ( ( "" + i ) + ":" ) + ( j + 1 ) ; if ( ! ( MAP_PATH_BOUNDARY_BUTTONS_NAME . contains ( name ) ) ) ApplicationStatics . MAP_PATH_BOUNDARY_BUTTONS_NAME += name + "," ; } } if ( j > 0 ) { if ( ( ( ( mapModel . mapGridSelection [ i ] [ ( j - 1 ) ] ) != 1 ) && ( ( mapModel . mapGridSelection [ i ] [ ( j - 1 ) ] ) != 2 ) ) && ( ( mapModel . mapGridSelection [ i ] [ ( j - 1 ) ] ) != 3 ) ) { name = ( ( "" + i ) + ":" ) + ( j - 1 ) ;

Fix:
final JButton [ ] [ ] b = new JButton [ mapModel . getMapHeight ( ) ] [ mapModel . getMapWidth ( ) ] ;