Home > Back-end >  Use data to delete selected row is always been warned "AWT EventQueue - 0" null pointer is
Use data to delete selected row is always been warned "AWT EventQueue - 0" null pointer is

Time:12-23

Every time to run the program click delete prompt model. RemoveRow (row 1); This line of code "AWT - EventQueue - 0" null Pointers, but I see the other people all can normal delete, himself a new not even database data test no problem, but a run to the oneself have connect to the database application will appear in this warning,
Because I was through the Vector rowData=https://bbs.csdn.net/topics/PutinStorage.getRows ();
The Vector columnNames=PutinStorage. GetHead ();
To access database header and the data in a row and then use the code table. The setModel (new DefaultTableModel (rowData, columnNames)); The header and get directly to each row of data in the form of a table display in the window, don't know if it has something to do with this, and if so how to change to delete selected lines not null Pointers to warn,

Here is the part of the "delete" button code I wrote:
Table. SetSelectionMode (ListSelectionModel. MULTIPLE_INTERVAL_SELECTION);
JButton del=new JButton (" delete ");
Del. AddActionListener (new ActionListener ()
{

Public void actionPerformed (an ActionEvent e)
{
//TODO Auto - generated method stub
//delete access line, there is no choice is - 1
Int row=table. GetSelectedColumn ();
If (row==1)
{
JOptionPane. ShowMessageDialog (Text2. This, please choose to delete rows! "" );
}
The else
{
Model. RemoveRow (row 1);
}
}
});
  • Related