int selectedRow = tblMembership.getSelectedRow();
if (selectedRow == -1) {
JOptionPane.showMessageDialog(rootPane, "You must chose one membership type first!", "Error!", JOptionPane.ERROR_MESSAGE);
} else {
int id = (int) tblMembership.getModel().getValueAt(selectedRow, 0);
DataMembership dataMembership = new DataMembership();
MembershipTypeBean bean = dataMembership.getTypeByID(id);
txtTypeName.setText(bean.getTypeName());
txtMainDuty.setText(bean.getMain_Duty());
spinFee.setValue(bean.getFee());
spinMinAttendance.setValue(bean.getMin_Attendance());
spinDiscount.setValue(bean.getDiscount());