Guest User

Untitled

a guest
Aug 19th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. Excel-like JTable Cell Editor, with an empty cell at edition start
  2. public void propertyChange(PropertyChangeEvent e)
  3. {
  4. // A cell has started/stopped editing
  5. if ("tableCellEditor".equals(e.getPropertyName()))
  6. {
  7. if (table.isEditing())
  8. processEditingStarted();
  9. else
  10. processEditingStopped();
  11. }
  12. }
  13.  
  14. private void processEditingStarted()
  15. {
  16. SwingUtilities.invokeLater( this );
  17. }
  18.  
  19. public void run()
  20. {
  21. row = table.convertRowIndexToModel( table.getEditingRow() );
  22. column = table.convertColumnIndexToModel( table.getEditingColumn() );
  23. oldValue = table.getModel().getValueAt(row, column);
  24. newValue = null;
  25.  
  26. table.getModel().setValueAt(null, row, column);
  27. table.updateUI();
  28. }
Add Comment
Please, Sign In to add comment