Buggy code:
w < ( Team . size ( ) ) ; w ++ ) { if ( ( Team . get ( w ) . getPlayerType ( ) . toString ( ) ) == ( PlayerTypes [ q ] ) ) { PlayerPanel Playerpanel = new PlayerPanel ( Team . get ( w ) , 0 ) ; Playerpanel . setLayout ( new BorderLayout ( ) ) ; Playerpanel . setBorder ( BorderFactory . createMatteBorder ( 0 , 0 , 1 , 0 , new Color ( 200 , 200 , 200 ) ) ) ; ImageIcon myImageIcon ; if ( ( Team . get ( w ) . getDaysInjured ( ) ) > 0 ) { myImageIcon = createImageIcon ( "images//red-cross.png" ) ; } else if ( ( Team . get ( w ) . getDaysSuspended ( ) ) > 0 ) { myImageIcon = createImageIcon ( "images//red-card.png" ) ; } else { myImageIcon = createImageIcon ( ( ( "images//Shirts//" + ( Integer . toString ( Team . get ( w ) . getNumber ( ) ) ) ) + ".png" ) ) ; } JLabel label1 = new JLabel ( "" ) { @ Override public void paintComponent ( Graphics g ) { super . paintComponent ( g ) ; g . drawImage ( myImageIcon . getImage ( ) , 0 , 0 , 55 , 55 , null ) ; } } ; label1 . setPreferredSize ( new Dimension ( 65 , 55 ) ) ; JLabel label2 = new JLabel ( Team . get ( w ) . getName ( ) ) ; label2 . setFont ( fontPlayername ) ; label2 . setMinimumSize ( new Dimension ( 20 , 50 ) ) ; label2 . setPreferredSize ( new Dimension ( 90 , 50 ) ) ; label2 . setMaximumSize ( new Dimension ( 100 , 50 ) ) ; JPanel label3 = new JPanel ( ) ; label3 . setMinimumSize ( new Dimension ( 75 , label3 . getSize ( ) . height ) ) ; label3 . setPreferredSize ( new Dimension ( 80 , label3 . getSize ( ) . height ) ) ; label3 . setMaximumSize ( new Dimension ( 100 , label3 . getSize ( ) . height ) ) ; if ( ( PlayerTypes [ q ] ) != "Goalkeeper" ) { FieldPlayer player = ( ( FieldPlayer ) ( Team . get ( w ) ) ) ; label3 . setLayout ( new GridLayout ( 2 , 2 ) ) ; int [ ] Attr = new int [ ] { player . getDefenseValue ( ) , player . getDribblingValue ( ) , player . getFinishingValue ( ) , player . getStaminaValue ( ) } ; JLabel [ ] AttrLabel = new JLabel [ ] { new JLabel ( ( "Def:<seq2seq4repair_space>" + ( Integer . toString ( Attr [ 0 ] ) ) ) ) , new JLabel ( ( "Dri:<seq2seq4repair_space>" + ( Integer . toString ( Attr [ 1 ] ) ) ) ) , new JLabel ( ( "Fin:<seq2seq4repair_space>" + ( Integer . toString ( Attr [ 2 ] ) ) ) ) , new JLabel ( ( "Sta:<seq2seq4repair_space>" + ( Integer . toString ( Attr [ 3 ] ) ) ) ) } ; for ( int e = 0 ; e < 4 ; e ++ ) { AttrLabel [ e ] . setFont ( fontPlayerattr ) ; label3 . add ( AttrLabel [ e ] ) ; if ( ( ( Team . get ( w ) . getDaysInjured ( ) ) > 0 ) || ( ( Team . get ( w ) . getDaysSuspended ( ) ) > 0 ) ) { AttrLabel [ e ] . setForeground ( new Color ( 255 , 255 , 255 ) ) ; } } } else { Goalkeeper player = ( ( Goalkeeper ) ( Team . get ( w ) ) ) ; label3 . setLayout ( new BoxLayout ( label3 , BoxLayout . X_AXIS ) ) ; JLabel attr = new JLabel ( ( "Stat:<seq2seq4repair_space>" + ( player . getGoalkeeperValue ( ) ) ) ) ; attr . setFont ( fontPlayerattr ) ; label3 . add ( attr ) ; if ( ( ( Team . get ( w ) . getDaysInjured ( ) ) > 0 ) || ( ( Team . get ( w ) . getDaysSuspended ( ) ) > 0 ) ) { attr . setForeground ( new Color ( 255 , 255 , 255 ) ) ; } } Playerpanel . add ( label1 , BorderLayout . WEST ) ; Playerpanel . add ( label2 , BorderLayout . CENTER ) ; Playerpanel . add ( label3 , BorderLayout . EAST ) ; ScrollPaneGrid . add ( Playerpanel ) ; if ( ( ( Team . get ( w ) . getDaysInjured ( ) ) > 0 ) || ( ( Team . get ( w ) . getDaysSuspended ( ) ) > 0 ) ) { Playerpanel . setBackground ( new Color ( 255 , 182 , 158 ) ) ; Playerpanel . setOpaque ( true ) ; Playerpanel . setBorder ( BorderFactory . createMatteBorder ( 0 , 0 , 1 , 0 , new Color ( 255 , 255 , 255 ) ) ) ; label2 . setForeground ( new Color ( 255 , 255 , 255 ) ) ; } else if ( currentTeam . getPositions ( ) . contains ( Team . get ( w ) ) ) { <START_BUG> Playerpanel . setBackground ( new Color ( 221 , 244 , 255 ) ) ; <END_BUG> Playerpanel . setOpaque ( true ) ; ds . createDefaultDragGestureRecognizer ( Playerpanel , DnDConstants . ACTION_COPY , dragGestureListener ) ; } else { ds . createDefaultDragGestureRecognizer ( Playerpanel , DnDConstants . ACTION_COPY , dragGestureListener ) ; } } } ScrollPaneContent . add ( ScrollPaneGrid ) ; } } public ImageIcon createImageIcon ( String path ) { } }

Fix:
Playerpanel . setBackground ( new Color ( 240 , 240 , 240 ) ) ;