Buggy code:
public class DominionClientWindow extends JFrame implements ActionListener { private DominionClient mClient ; private JPanel mContent ; private JPanel mAdminButtonPanel ; private JButton mStartGame ; private List < CardChoicePanel > mCardChoicePanels = new ArrayList < CardChoicePanel > ( ) ; private JTextArea mTextArea ; public static final String TOKEN_START_GAME_BUTTON_TEXT = "Start<seq2seq4repair_space>Game" ; public static final String TOKEN_STARTING_BUTTON_TEXT = "Starting..." ; public static final String TOKEN_START_GAME_FAILED = "Failed<seq2seq4repair_space>to<seq2seq4repair_space>start<seq2seq4repair_space>game" ; public static final String TOKEN_JOINING_GAME = "Joining<seq2seq4repair_space>game..." ; private static final int CARD_COLUMNS = 5 ; private static final int CARD_ROWS = 2 ; private static final String ACTION_START_GAME = "START" ; private static final Logger mLog = Logger . getLogger ( DominionClientWindow . class . getName ( ) ) ; public DominionClientWindow ( DominionClient aClient ) { } private void loadImages ( ) { } private void initComponents ( ) { mContent = new JPanel ( new GridBagLayout ( ) ) ; JScrollPane lContentScrollPane = new JScrollPane ( mContent ) ; lContentScrollPane . setHorizontalScrollBarPolicy ( JScrollPane . HORIZONTAL_SCROLLBAR_AS_NEEDED ) ; lContentScrollPane . setVerticalScrollBarPolicy ( JScrollPane . VERTICAL_SCROLLBAR_AS_NEEDED ) ; GridBagConstraints c = new GridBagConstraints ( ) ; c . anchor = GridBagConstraints . PAGE_START ; c . fill = GridBagConstraints . NONE ; c . insets = new Insets ( 5 , 5 , 5 , 5 ) ; c . weightx = 1.0 ; for ( int lRow = 0 ; lRow < ( DominionClientWindow . CARD_ROWS ) ; lRow ++ ) { c . gridy = lRow ; for ( int lColumn = 0 ; lColumn < ( DominionClientWindow . CARD_COLUMNS ) ; lColumn ++ ) { c . gridx = lColumn ; <START_BUG> CardChoicePanel lCCP = new CardChoicePanel ( ( ( lRow * ( DominionClientWindow . CARD_ROWS ) ) + lColumn ) , mClient ) ; <END_BUG> mContent . add ( lCCP , c ) ; mCardChoicePanels . add ( lCCP ) ; } } c . fill = GridBagConstraints . BOTH ; c . gridy = GridBagConstraints . RELATIVE ; c . gridx = 0 ; c . gridwidth = GridBagConstraints . REMAINDER ; c . insets = new Insets ( 0 , 0 , 0 , 0 ) ; c . weighty = 1.0 ; c . weightx = 1.0 ; mTextArea = new JTextArea ( ) ; mContent . add ( mTextArea , c ) ; if ( mClient . isAdmin ( ) ) { JPanel mAdminButtonPanel = new JPanel ( ) ; mStartGame = new JButton ( DominionClientWindow . TOKEN_START_GAME_BUTTON_TEXT ) ; mStartGame . setActionCommand ( DominionClientWindow . ACTION_START_GAME ) ; mStartGame . addActionListener ( this ) ; mAdminButtonPanel . add ( mStartGame ) ; c . anchor = GridBagConstraints . PAGE_END ; c . fill = GridBagConstraints . NONE ; c . weighty = 0.0 ; mContent . add ( mAdminButtonPanel , c ) ; } this . setContentPane ( lContentScrollPane ) ; } protected void displayMessage ( String aMessage ) { } @ Override public void actionPerformed ( ActionEvent arg0 ) { } public void refreshCardPool ( ) { } private class ImageLoader extends Thread { @ Override public void run ( ) { } } }

Fix:
CardChoicePanel lCCP = new CardChoicePanel ( ( ( lRow * ( DominionClientWindow . CARD_COLUMNS ) ) + lColumn ) , mClient ) ;