Delete Value from Table with JPopupMenu | Java Swing



Delete Value from Table with JPopupMenu | Java Swing

________________________________________________


DefaultTableModel model1 = (DefaultTableModel) table.getModel(); try{ int row = table.getSelectedRow(); int response = JOptionPane.showConfirmDialog(null, "Do you want delete?", "DELETE!", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if(response == JOptionPane.YES_OPTION){ model1.removeRow(row); JOptionPane.showMessageDialog(null, "Deleted!"); } }catch(Exception e){ JOptionPane.showMessageDialog(null, "Error!"); }

_____________________________________________


Dark Hers

https://darkhers.blogspot.com

YouTube

https://youtube.com/@darkhers

Instagram

https://instagram.com/darkhers

Facebook

https://www.facebook.com/darkhers

TikTok

https://www.tiktok.com/@darkhers

Pinterest

https://www.pinterest.co.uk/darkhers

Twitter

https://twitter.com/Dark_Hers

Comments

Popular Posts