private void dealBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dealBActionPerformed
        (new SwingWorker<String, Object>() {

            @Override
            public String doInBackground() {
                Board b = Board.getInstance();
                Company companies[] = b.getCompanies();
                Company c = (Company) JOptionPane.showInputDialog(BoardPanel.this,
                        "Select company to sell to...", "Patent Deal",
                        JOptionPane.QUESTION_MESSAGE, null, companies, companies[0]);

                if (c == null) {
                    return "Deal cancelled";
                }

                String str = JOptionPane.showInputDialog(BoardPanel.this,
                        "Enter your agreement amount ", "Patent Deal", JOptionPane.QUESTION_MESSAGE);
                if (str == null || str.isEmpty()) {
                    return "Deal cancelled";
                }

                try {
                    int amt = Integer.parseInt(str);
                    c.decrMoney(amt);
                    c.incrPatentCount();

                    Company co = b.getCompany(b.getSelectIndex());
                    co.incrMoney(amt);
                    c.decrPatentCount();
                    return co + " sold 1 patent to " + c;
                } catch (NumberFormatException e) {
                    return "Deal cancelled";
                }
            }

            @Override
            protected void done() {
                try {
                    msgTP.setText(get());
                } catch (InterruptedException | ExecutionException ex) {
                    ex.printStackTrace(System.err);
                }
            }
        }).execute();
    }//GEN-LAST:event_dealBActionPerformed