Update of /cvsroot/jprojecttimer/jprojecttimer/de/cgarbs/apps/jprojecttimer
In directory usw-pr-cvs1:/tmp/cvs-serv13552
Modified Files:
TaskListPane.java
Log Message:
Task 45750: Tasks can be edited by double-clicking on them. Code submission by Oliver Kalkofen <OKa...@we...>
Index: TaskListPane.java
===================================================================
RCS file: /cvsroot/jprojecttimer/jprojecttimer/de/cgarbs/apps/jprojecttimer/TaskListPane.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** TaskListPane.java 2002/01/12 14:18:45 1.2
--- TaskListPane.java 2002/01/15 22:18:10 1.3
***************
*** 2,6 ****
* $Id$
*
! * 2001 (C) by Christian Garbs <mi...@un...>
*
* Licensed under GNU GPL (see COPYING for details)
--- 2,7 ----
* $Id$
*
! * 2001 (C) by Christian Garbs <mi...@cg...>
! * Oliver Kalkofen <OKa...@we...>
*
* Licensed under GNU GPL (see COPYING for details)
***************
*** 13,16 ****
--- 14,19 ----
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+ import java.awt.event.MouseAdapter;
+ import java.awt.event.MouseEvent;
import java.util.Enumeration;
import javax.swing.JButton;
***************
*** 27,34 ****
--- 30,53 ----
public class TaskListPane extends JPanel implements ActionListener
{
+ /** Inner class MouseAdapter
+ * 2DO: BUTTON1_MASK -> just accept left double clicks
+ */
+ private MouseAdapter taskListMouseAdapter = new MouseAdapter()
+ {
+ public void mouseClicked(MouseEvent e) {
+ if (e.getClickCount() == 2) {
+ edit.doClick();
+ }
+ }
+ };
+
final static String NEW_BUTTON = "new";
final static String EDIT_BUTTON = "edit";
final static String DEL_BUTTON = "del";
+ private JButton add;
+ private JButton del;
+ private JButton edit;
+
/** */
JTable table;
***************
*** 48,55 ****
this.gui = gui;
- JButton add;
- JButton del;
- JButton edit;
-
model = new TaskListTableModel(tasks);
table = new JTable(model);
--- 67,70 ----
***************
*** 62,65 ****
--- 77,81 ----
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ table.addMouseListener(taskListMouseAdapter);
JScrollPane scrollPane = new JScrollPane(table);
***************
*** 130,132 ****
--- 146,149 ----
model.fireTableDataChanged();
}
+
}
|