private void fetchAndSaveSelectedPaymentModes() { for (AmountInfo tempAI : vectAI) { vectPaymentModeIDs.add(tempAI.getPaymentMode()); vectPaymentModeNames.add(UsefulMethods.getPaymentModeString(tempAI.getPaymentMode())); } jList1.setListData(vectPaymentModeNames.toArray()); jList1.setListData(vectPaymentModeNames.toArray()); try { jList1.setSelectedIndex(0); } catch (Exception e) { } }
private void ensureReturnAmount() { int row = this.jList1.getSelectedIndex(); if (row != -1) { int selectedPaymentMode = vectPaymentModeIDs.get(row); ai.setPaymentMode(selectedPaymentMode); ai.setAmount( -1); // explicitly set it to negetive quantity, so that it can be catched at the // transaction page this.dispose(); } else { JOptionPane.showMessageDialog(this, "Payment mode is not selected."); jList1.requestFocus(); } }