private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    try {
        int a = jList1.getSelectedIndex();
        int b = jList1.getLastVisibleIndex();
        int c = jList1.getFirstVisibleIndex();

        btnRemove.setEnabled(true);
        v1.add(jList1.getSelectedValue());
        v2.remove(jList1.getSelectedValue());

        jList3.setListData(v1);
        jList1.setListData(v2);

        if (v2.isEmpty()) {
            jButton1.setEnabled(false);
        } else if (a == c) {
            jList1.setSelectedIndex(c);
        } else if (a > c && a < b) {
            jList1.setSelectedIndex(a);
        } else if (a == b) {
            jList1.setSelectedIndex(b - 1);
        }
        jList3.setSelectedIndex(0);
    } catch (NullPointerException e) {
        System.out.println("Null pointer exception");
    }

}//GEN-LAST:event_jButton1ActionPerformed