void buyButton_actionPerformed(ActionEvent e) {
        int n = topTable.getSelectedRow();
        if (n != -1) {
            Card c = topModel.rowToCard(n);

            if (c.getValue() <= questData.getCredits()) {
                bottomModel.addCard(c);
                bottomModel.resort();

                topModel.removeCard(c);

                questData.subtractCredits(c.getValue());
                questData.addCard(c);

                questData.removeCardFromShopList(c);

                creditsLabel.setText("Total credits: " + questData.getCredits());

                //3 conditions" 0 cards left, select the same row, select next row
                int size = topModel.getRowCount();
                if (size != 0) {
                    if (size == n) n--;
                    topTable.addRowSelectionInterval(n, n);
                }
            } else {
                JOptionPane.showMessageDialog(null, "Not enough credits!");
            }
        }//if(valid row)
    }//buyButton_actionPerformed