dialog = new DialogCategory(SwingUtil.getParentJFrame(this), true);
}
int id = ( Integer ) TableCategory.getValueAt(TableCategory.getSelectedRow(), 0);
Category category=null;
try {
category = categoryDAO.findById(id);
} catch (SQLException ex) {
Logger.getLogger(InternalFrameCategory.class.getName()).log(Level.SEVERE, null, ex);
}
dialog.setCategory(category);
dialog.setVisible(true);
if ( dialog.getMode() == DialogCategory.SAVE_MODE ){
//category = dialog.getCategory();
dialog.packData();
try {
categoryDAO.update(category.getId(), category);
} catch (SQLException ex) {
Logger.getLogger(InternalFrameCategory.class.getName()).log(Level.SEVERE, null, ex);
JOptionPane.showMessageDialog(this, "error " + ex.getMessage(), "sql exception", JOptionPane.ERROR_MESSAGE);
}