You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jakarta.apache.org by mi...@apache.org on 2010/10/18 00:36:36 UTC
svn commit: r1023592 -
/jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/TextBoxDialoger.java
Author: milamber
Date: Sun Oct 17 22:36:35 2010
New Revision: 1023592
URL: http://svn.apache.org/viewvc?rev=1023592&view=rev
Log:
Adding a new inner class to allow display a text box to edit cell content in Jtable (futur use in ArgumentsPanel)
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/TextBoxDialoger.java
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/TextBoxDialoger.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/TextBoxDialoger.java?rev=1023592&r1=1023591&r2=1023592&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/TextBoxDialoger.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/TextBoxDialoger.java Sun Oct 17 22:36:35 2010
@@ -86,8 +86,8 @@ public class TextBoxDialoger implements
* @param editable - allow to modify text
*/
public TextBoxDialoger(String text, boolean editable) {
- init(text);
this.editable = editable;
+ init(text);
}
private void init(String text) {
@@ -191,5 +191,36 @@ public class TextBoxDialoger implements
}
}
+ /**
+ * Class to edit in a dialog box the cell's content
+ * when double (pressed) click on a table's cell which is editable
+ *
+ */
+ public static class TextBoxDoubleClickPressed extends MouseAdapter {
+
+ private JTable table = null;
+
+ public TextBoxDoubleClickPressed(JTable table) {
+ super();
+ this.table = table;
+ }
+
+ @Override
+ public void mousePressed(MouseEvent e) {
+ if (e.getClickCount() == 2) { // double (pressed) click
+ TableModel tm = table.getModel();
+ Object value = tm.getValueAt(table.getSelectedRow(), table.getSelectedColumn());
+ if (value instanceof String) {
+ if (table.getCellEditor() != null) {
+ table.getCellEditor().cancelCellEditing(); // in main table (evt mousePressed because cell is editable)
+ }
+ TextBoxDialoger tbd = new TextBoxDialoger(value.toString(), true);
+ tm.setValueAt(tbd.getTextBox(), table.getSelectedRow(), table.getSelectedColumn());
+ } // else do nothing (cell isn't a string to edit)
+ }
+ }
+
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@jakarta.apache.org
For additional commands, e-mail: notifications-help@jakarta.apache.org