|
@@ -17,6 +17,8 @@ import ui.model.Model;
|
|
|
|
|
|
import javax.swing.*;
|
|
|
import javax.swing.border.LineBorder;
|
|
|
+import javax.swing.event.AncestorEvent;
|
|
|
+import javax.swing.event.AncestorListener;
|
|
|
import javax.swing.filechooser.FileNameExtensionFilter;
|
|
|
import javax.swing.table.DefaultTableModel;
|
|
|
import javax.swing.table.JTableHeader;
|
|
@@ -1304,8 +1306,30 @@ public class GUI implements CategoryListener {
|
|
|
xBThis = e.getX();
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void mouseExited(MouseEvent e) {
|
|
|
+ /**
|
|
|
+ * Stop Editing, if mouse exits the Table
|
|
|
+ */
|
|
|
+ JTable holElem = model.getTableHolonElement();
|
|
|
+ if(e.getX()<=0 || e.getX()>=holElem.getWidth()
|
|
|
+ || e.getY() <= 0 || e.getY()>= holElem.getHeight()){
|
|
|
+ CellEditor cellEditor = holElem.getCellEditor();
|
|
|
+ if (cellEditor != null) {
|
|
|
+ if (cellEditor.getCellEditorValue() != null) {
|
|
|
+ /** TODO: Maybe try to save current Data */
|
|
|
+ cellEditor.stopCellEditing();
|
|
|
+ } else {
|
|
|
+ cellEditor.cancelCellEditing();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
/*
|
|
|
* Triggered every time a change is made
|
|
|
*/
|