Directly enter edit mode of JTable cell

Hi Everyone,
On my UI, i am showing editable JTable. When I click on table's row / cell, it selects the row. Fine.
But I want that it should directly enter edit mode of cell and the whole text is to be selected and highlighted and focussed.
Thus, user can directly type the new text.
Please suggest correct approach to handle this scenario.
Thanks in advance.
Girish Varde.

Here is my attempt at solving this problem:
**  For text selection you have two choices. Remove the "xxx" from either
**  editCellAt() or prepareEditor() method.
**  The difference is in how mouse double clicking works
**  To place a cell directly into edit mode, use the changeSelection() method.
**  Be aware this will generate a TableModelEvent every time you leave a cell.
**  You can also use either of the above text selection methods.
import java.awt.*;
import java.util.*;
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.table.*;
public class TableEditCell extends JFrame
     public TableEditCell()
          String[] columnNames = {"Number", "Letter"};
          Object[][] data = { {"1", "A"}, {"2", "B"}, {"3", "C"} };
          JTable table = new JTable(data, columnNames)
               //  Place cell in edit mode when it 'gains focus'
               public void xxxchangeSelection(
                    int row, int column, boolean toggle, boolean extend)
                    super.changeSelection(row, column, toggle, extend);
                    if (editCellAt(row, column))
                         getEditorComponent().requestFocusInWindow();
               //  Select the text when the cell starts editing
               //  a) text will be replaced when you start typing in a cell
               //  b) text will be selected when you use F2 to start editing
               //  c) text will be selected when double clicking to start editing
               public boolean xxxeditCellAt(int row, int column, EventObject e)
                    boolean result = super.editCellAt(row, column, e);
                    final Component editor = getEditorComponent();
                    if (editor != null && editor instanceof JTextComponent)
                         if (e == null)
                              ((JTextComponent)editor).selectAll();
                         else
                              SwingUtilities.invokeLater(new Runnable()
                                   public void run()
                                        ((JTextComponent)editor).selectAll();
                    return result;
               //  Select the text when the cell starts editing
               //  a) text will be replaced when you start typing in a cell
               //  b) text will be selected when you use F2 to start editing
               //  c) caret is placed at end of text when double clicking to start editing
               public Component xxxprepareEditor(
                    TableCellEditor editor, int row, int column)
                    Component c = super.prepareEditor(editor, row, column);
                    if (c instanceof JTextComponent)
                         ((JTextField)c).selectAll();
                    return c;
          JScrollPane scrollPane = new JScrollPane( table );
          getContentPane().add( scrollPane );
     public static void main(String[] args)
          TableEditCell frame = new TableEditCell();
          frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
          frame.pack();
          frame.setLocationRelativeTo( null );
          frame.setVisible(true);
}

Similar Messages

  • Strange TableView problem when entering editing mode.

    I'm having a problem when entering editing mode in a tableview. What happens is the cell data from the section below is being displayed on top of the last cell in the current section.
    The narrower cell, with the plus sign on the left side, is briefly visible before (a copy of) the cell from below covers it up.
    Has anyone else seen this behavior? I'm really stumped here.
    More info, or how my table isn't standard: Each of the three sections is populated from a list. If the user has previously deleted one of the items from the section, only then is the plus sign shown. Otherwise, only the delete sign is shown. In other words, if there isn't anything to add, then the plus sign with the associated ...add a new X is not shown. This all works correctly. The counters work. The lists of previously deleted items are populated correctly.
    What doesn't work is the last row of the second section being covered by a copy (at full width) of the first row from the third section. The first and third sections both look correct. phew, I hope this makes sense.
    Here is what it looks like:
    Sizes
    - Size 1
    - Size 2
    + ..add a new Size
    Measurements
    - Measurement 1
    - Measurement 2
    Note 1 << this is the problem row
    Notes
    - Note 1
    - Note 2
    + ...add a new Note
    Thanks for any help you can provide.
    Ty

    OK, after more digging I answered my own question.
    The problem was the section order for added and deleting rows in setEditing. I was setting the indexPathForRow in section 2, then, 1, then 0. If I do the update in order 0, 1, then 2 it works fine in 2.0, 2.1, and 2.2.

  • Native Notes app requires two taps to enter edit mode

    I use the native notes app a lot. With iOS 3, I would tap on the name of the note to view it, then tap once to enter edit mode (the keyboard appears). Now, with iOS 4, I have to tap on the note twice to enter edit mode. This is very annoying.
    It might have something to do with the new feature in iOS4 that recognizes dates. If I tap anywhere in a note that is even remotely close to something it has recognized as a date, I get the “create event” pop-up instead of the keyboard.
    Does anyone else experience this? Or is it only me? Unfortunately, I cannot delete notes and reinstall it… Is there a fix for this?
    Details: 16GB 3GS, iOS 4.0.1

    More information:
    I noticed that if I create a note on the iPhone, it works fine. I can enter edit mode with one tap. But once I sync that note to Outlook, or if I create a note with Outlook, it takes two taps to enter edit mode.
    This did not happen with iOS 3

  • Problem using an editable JComboBox as JTable cell editor

    Hi,
    i have a problem using an editable JComboBox as cell editor in a JTable.
    When i edit the combo and then I press the TAB or ENTER key then all works fine and the value in the TableModel is updated with the edited one, but if i leave the cell with the mouse then the value is not passed to the TableModel. Why ? Is there a way to solve this problem ?
    Regards
    sergio sette

    if (v1.4) [url
    http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JTa
    le.html#setSurrendersFocusOnKeystroke(boolean)]go
    hereelse [url
    http://forum.java.sun.com/thread.jsp?forum=57&thread=43
    440]go here
    Thank you. I've also found this one (the first reply): http://forum.java.sun.com/thread.jsp?forum=57&thread=124361 Works fine for me.
    Regards
    sergio sette

  • Programatically change( edit?? ) JTable cell value

    If my user changes the value in cell 'A', I'd like to change the value in cell 'B' to the results of a calculation performed using the new value in A with the present ( prior to changing ) value in B.
    Example:
    Cell: suggested_sell_price
    Cell: cost_this_item
    A change in the cost_this_item cell would be reflected in the suggested_sell_price,(upon hitting enter the values are stored in the DB)
    Any suggestions would be greatly appreciated,

    Thanks for the suggestions. I'm posting a test program of what I have at the moment, it has some of the behavior I'm looking for, but I can't seem to get the new value of an aedited cell and set the table model with the new value.
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.table.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    public class TE extends JFrame
         String[] cols = {"VAL_1", "VAL_2", "VAL_3"};
         Object[][] filler = {
                                       {new Double(100.00), new Double(100.00), new Double(100.00)},
                                       {new Double(200.00), new Double(200.00), new Double(200.00)},
                                       {new Double(400.00), new Double(400.00), new Double(400.00)}
         JTable table;
         TE(String title)
                   super(title);
                   this.setDefaultCloseOperation(EXIT_ON_CLOSE);
                   MTM mtm = new MTM(3, cols.length);
                   mtm.setColumnIdentifiers(cols);
                   int nRows = filler.length;
                   for(int i = 0; i < nRows; ++i)
                             mtm.setValueAt(filler[0], 0, i);
                             mtm.setValueAt(filler[1][i], 1, i);
                             mtm.setValueAt(filler[2][i], 2, i);
                   table = new JTable(mtm);
                   table.getColumnModel().getColumn(1).setCellEditor(new SimpleCellEditor());
                   table.getColumnModel().getColumn(2).setCellEditor(new SimpleCellEditor());
                   //table.getColumnModel().getColumn(2).setCellEditor(new SimpleCellEditor());
                   JScrollPane jsp = new JScrollPane(table);
                   Container c = getContentPane();
                   c.add(jsp);
                   setSize(300,300);
                   setVisible(true);
         class MyMouseListener extends MouseAdapter
                   public void mouseClicked(MouseEvent e)
                        if(e.getClickCount() == 2)
                                  table.setValueAt("QQQQQQQ", 1,1);
    class SimpleCellEditor extends AbstractCellEditor implements TableCellEditor, ActionListener
         JTextField tf = new JTextField();
         TableModel tm = table.getModel();
         protected EventListenerList listenerList = new EventListenerList();
         protected ChangeEvent changeEvent = new ChangeEvent(this);
         public SimpleCellEditor()
                   super();                              
                   tf.addMouseListener(new MyMouseListener());
                   tf.addActionListener(this);
    public void addCellEditorListener(CellEditorListener listener) {
    listenerList.add(CellEditorListener.class, listener);
    public void removeCellEditorListener(CellEditorListener listener) {
    listenerList.remove(CellEditorListener.class, listener);
    protected void fireEditingStopped()
              CellEditorListener listener;
              Object[] listeners = listenerList.getListenerList();
              for (int i = 0; i < listeners.length; i++)
                   if (listeners[i] == CellEditorListener.class)
                             listener = (CellEditorListener) listeners[i + 1];
                             listener.editingStopped(changeEvent);
    protected void fireEditingCanceled()
         CellEditorListener listener;
              Object[] listeners = listenerList.getListenerList();
                   for (int i = 0; i < listeners.length; i++)
                   if (listeners[i] == CellEditorListener.class)
                        listener = (CellEditorListener) listeners[i + 1];
                        listener.editingCanceled(changeEvent);
    public void cancelCellEditing()
              fireEditingCanceled();
    public boolean stopCellEditing()
              fireEditingStopped();
              return true;
    public boolean isCellEditable(EventObject event)
              return true;
         public boolean shouldSelectCell(EventObject event)
         return true;
    public Object getCellEditorValue()
         return tf.getText();
    public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
         if(tf.hasFocus() == true)
                   tf.setBackground(Color.CYAN);
              return tf;
         public void actionPerformed(ActionEvent e)
              int row = table.getSelectedRow();
              int col = table.getSelectedColumn();
              double nVal = 0.00;
              Object currCostVal;
              Object currSellVal;
              Double costVal;
              Double sellVal;
              double newSellVal;
              double currentCost;
              if(table.getSelectedColumn() == 1)
                   currCostVal = table.getValueAt(row, col+1);
                   currSellVal = table.getValueAt(row, col);
                   costVal = new Double(currCostVal.toString());
                   currentCost = costVal.doubleValue();
                   sellVal = new Double(currSellVal.toString());
                   newSellVal = sellVal.doubleValue();
                   nVal = newSellVal*currentCost*100/100;
                   System.out.println("Recommended sell-price after change: " + nVal);
              }else if(table.getSelectedColumn() == 2 )
                        currCostVal = table.getValueAt(row, col);
                        currSellVal = table.getValueAt(row, col-1);
                        costVal = new Double(currCostVal.toString());
                        currentCost = costVal.doubleValue();
                        sellVal = new Double(currSellVal.toString());
                        newSellVal = sellVal.doubleValue();
                        nVal = newSellVal*currentCost*100/100;
                        System.out.println("Recommended sell-price after change: " + nVal);
                        System.out.println("Cost column selected " + nVal);
    }// end simple cell editor
    class MTM extends DefaultTableModel
              MTM(int rows, int cols)
                        super(rows, cols);
    public static void main(String args[])
              TE te = new TE("Test of table cell update");

  • Editing/Assigning each JTable cell with a unique JComboBox

    unique JComboBox meaning the contents of each will be different for each cell.
    anyone have any ideas how to go about doing this?
    Seems like you can set a DefaultCellEditor for each column only.

    problem sorted, used a modified version of http://forum.java.sun.com/thread.jspa?forumID=57&threadID=327150
    where i used my underlying datamodel instead of the predefined combo boxes in that example

  • Combo in JTable Cell

    Hi Everyone,
    1) I want to display combo boxes in some selected colmns of my JTable.
    2) I want the user to enter table cell's edit mode directly when he clicks on a cell.
    For above functionality No. 2), i got following running code from this forum (Mr. Camickr) as follows. Can you guys suggest me where and how to add code to display combo?
    Thanks in advance.
    Girish Varde
    ** For text selection you have two choices. Remove the "xxx" from either
    ** editCellAt() or prepareEditor() method.
    ** The difference is in how mouse double clicking works
    ** To place a cell directly into edit mode, use the changeSelection() method.
    ** Be aware this will generate a TableModelEvent every time you leave a cell.
    ** You can also use either of the above text selection methods.

    import java.awt.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.text.*;
    import javax.swing.table.*;

    public class TableEditCell extends JFrame
    public TableEditCell()
    String[] columnNames = {"Number", "Letter"};
    Object[][] data = { {"1", "A"}, {"2", "B"}, {"3", "C"} };

    JTable table = new JTable(data, columnNames)
    // Place cell in edit mode when it 'gains focus'

    public void xxxchangeSelection(
    int row, int column, boolean toggle, boolean extend)
    super.changeSelection(row, column, toggle, extend);

    if (editCellAt(row, column))
    getEditorComponent().requestFocusInWindow();

    // Select the text when the cell starts editing
    // a) text will be replaced when you start typing in a cell
    // b) text will be selected when you use F2 to start editing
    // c) text will be selected when double clicking to start editing

    public boolean xxxeditCellAt(int row, int column, EventObject e)
    boolean result = super.editCellAt(row, column, e);
    final Component editor = getEditorComponent();

    if (editor != null && editor instanceof JTextComponent)
    if (e == null)
    ((JTextComponent)editor).selectAll();
    else
    SwingUtilities.invokeLater(new Runnable()
    public void run()
    ((JTextComponent)editor).selectAll();

    return result;

    // Select the text when the cell starts editing
    // a) text will be replaced when you start typing in a cell
    // b) text will be selected when you use F2 to start editing
    // c) caret is placed at end of text when double clicking to start editing

    public Component xxxprepareEditor(
    TableCellEditor editor, int row, int column)
    Component c = super.prepareEditor(editor, row, column);

    if (c instanceof JTextComponent)
    ((JTextField)c).selectAll();

    return c;

    JScrollPane scrollPane = new JScrollPane( table );
    getContentPane().add( scrollPane );

    public static void main(String[] args)
    TableEditCell frame = new TableEditCell();
    frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
    frame.pack();
    frame.setLocationRelativeTo( null );
    frame.setVisible(true);
    -------------------------------------------------------------------------------------------------------�

    OK. Here is my code divided in two classes
    package com.apsiva.client.pi;
    * @author Administrator
    * TODO To change the template for this generated type comment go to
    * Window - Preferences - Java - Code Style - Code Templates
    import java.awt.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.text.*;
    import javax.swing.table.*;
    import com.apsiva.client.iedit.ItemCellEditor;
    public class TableEditCell extends JFrame
            public TableEditCell()
                    String[] columnNames = {"Number", "Letter"};
                    Object[][] data = { {"1", "A"}, {"2", "B"}, {"3", "C"} };
                    JTable table = new JTable(data, columnNames)
                            //  Place cell in edit mode when it 'gains focus'
                            public void changeSelection(
                                    int row, int column, boolean toggle, boolean extend)
                                    super.changeSelection(row, column, toggle, extend);
                                    if (editCellAt(row, column))
                                            getEditorComponent().requestFocusInWindow();
                            //  Select the text when the cell starts editing
                            //  a) text will be replaced when you start typing in a cell
                            //  b) text will be selected when you use F2 to start editing
                            //  c) text will be selected when double clicking to start editing
    //                        public boolean xxxeditCellAt(int row, int column, EventObject e)
                            public boolean xxxeditCellAt(int row, int column, EventObject e)
                                    boolean result = super.editCellAt(row, column, e);
                                    final Component editor = getEditorComponent();
                                    if (editor != null && editor instanceof JTextComponent)
                                            if (e == null)
                                                    ((JTextComponent)editor).selectAll();
                                            else
                                                    SwingUtilities.invokeLater(new Runnable()
                                                            public void run()
                                                                    ((JTextComponent)editor).selectAll();
                                    return result;
                            //  Select the text when the cell starts editing
                            //  a) text will be replaced when you start typing in a cell
                            //  b) text will be selected when you use F2 to start editing
                            //  c) caret is placed at end of text when double clicking to start editing
    //                        public Component xxxprepareEditor(
                            public Component prepareEditor(
                                    TableCellEditor editor, int row, int column)
                                    Component c = super.prepareEditor(editor, row, column);
                                    if (c instanceof JTextComponent)
                                            ((JTextField)c).selectAll();
                                    return c;
                    JScrollPane scrollPane = new JScrollPane( table );
                    getContentPane().add( scrollPane );
                    String[] data1 = {"A","B","C"} ;
                    String[] data2 = {"D","E","F"} ;
                    String[] data3 = {"G","H","I"} ;
                    Vector comboBoxModels = new Vector() ;
                    comboBoxModels.addElement(new DefaultComboBoxModel(data1)) ;
                    comboBoxModels.addElement(new DefaultComboBoxModel(data2)) ;
                    comboBoxModels.addElement(new DefaultComboBoxModel(data3)) ; 
                    ItemCellEditor ice = new ItemCellEditor(new JComboBox(comboBoxModels));
                    table.getColumnModel().getColumn(0).setCellEditor(ice) ;
            public static void main(String[] args)
                    TableEditCell frame = new TableEditCell();
                    frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
                    frame.pack();
                    frame.setLocationRelativeTo( null );
                    frame.setVisible(true);
    package com.apsiva.client.iedit;
    * @author Administrator
    * TODO To change the template for this generated type comment go to
    * Window - Preferences - Java - Code Style - Code Templates
    * Created on Mar 16, 2005
    * TODO To change the template for this generated file go to
    * Window - Preferences - Java - Code Style - Code Templates
    import java.awt.Component;
    import java.util.EventObject;
    import java.util.Vector;
    import javax.swing.*;
    import javax.swing.event.CellEditorListener;
    * @author Administrator
    * TODO To change the template for this generated type comment go to
    * Window - Preferences - Java - Code Style - Code Templates
    public class ItemCellEditor extends  DefaultCellEditor implements javax.swing.table.TableCellEditor {
          * @param arg0
         public ItemCellEditor(JComboBox arg0) {
              super(arg0);
              // TODO Auto-generated constructor stub
         /* (non-Javadoc)
          * @see javax.swing.CellEditor#addCellEditorListener(javax.swing.event.CellEditorListener)
         /* (non-Javadoc)
          * @see javax.swing.table.TableCellEditor#getTableCellEditorComponent(javax.swing.JTable, java.lang.Object, boolean, int, int)
          public Component getTableCellEditorComponent(
                     JTable table, Object value, boolean isSelected,int row,
                     int column ) {
              // TODO Auto-generated method stub
    //                      if (iRowToEdit != row)  //For disabling editing
    //                      return null;
                          int i = 0;
    //                      return super.getTableCellEditorComponent(
    //                      table, value, isSelected,row, column );
                          JComboBox combo = (JComboBox) super.getTableCellEditorComponent(
                                    table, value, isSelected,row, column );
                         String[] data1 = {"A","B","C"} ;
                         String[] data2 = {"D","E","F"} ;
                         String[] data3 = {"G","H","I"} ;
                         Vector comboOptions = new Vector();
                         comboOptions.add("Choice 1");
                           comboOptions.add("Choice 2");
                            comboOptions.add("Choice 3");
                            comboOptions.add("Choice 4");
                         ComboBoxModel comboBoxModels = new DefaultComboBoxModel(comboOptions) ;
                         combo.setModel(comboBoxModels);
                      if (column == 0 )   return combo;
                          return super.getTableCellEditorComponent(
                                    table, value, isSelected,row, column );
         /* (non-Javadoc)
          * @see javax.swing.CellEditor#addCellEditorListener(javax.swing.event.CellEditorListener)
         public void addCellEditorListener(CellEditorListener arg0) {
              // TODO Auto-generated method stub
               int i = 0;
         /* (non-Javadoc)
          * @see javax.swing.CellEditor#cancelCellEditing()
         public void cancelCellEditing() {
              // TODO Auto-generated method stub
               int i = 0;
         /* (non-Javadoc)
          * @see javax.swing.CellEditor#getCellEditorValue()
         public Object getCellEditorValue() {
              // TODO Auto-generated method stub
               int i = 0;
              return null;
         /* (non-Javadoc)
          * @see javax.swing.CellEditor#isCellEditable(java.util.EventObject)
         public boolean isCellEditable(EventObject arg0) {
              // TODO Auto-generated method stub
              JTable table = (JTable)arg0.getSource();
              int column = table.getSelectedColumn();
               int i = 0;
               return true;
         /* (non-Javadoc)
          * @see javax.swing.CellEditor#removeCellEditorListener(javax.swing.event.CellEditorListener)
         public void removeCellEditorListener(CellEditorListener arg0) {
               int i = 0;
              // TODO Auto-generated method stub
         /* (non-Javadoc)
          * @see javax.swing.CellEditor#shouldSelectCell(java.util.EventObject)
         public boolean shouldSelectCell(EventObject arg0) {
              // TODO Auto-generated method stub
               int i = 0;
              return true;
         /* (non-Javadoc)
          * @see javax.swing.CellEditor#stopCellEditing()
         public boolean stopCellEditing() {
              // TODO Auto-generated method stub
               int i = 0;
              return false;
    --------------------------------------------------------------------------------------------------When i click outside table, then once again the cells become editable unless first column is clicked.
    Please suggest a solution.
    Thanks and regards,
    Girish Varde

  • JTable cell editor problem

    Hi, I have a custom cell editor component being used on my JTable (a calendar component) and am having problems bringing the component out of edit mode when selecting another cell.
    If I click on a cell it enters edit mode correctly, the I can drop a popup window out from this editor to display the calendar. If however I move to another cell this window remains active.
    Could anyone explain how to come out of edit mode when moving to another cell (not necessarily selecting just moving the mouse in to another) ?
    I also have a second problem in that the calendar editor doesn't set the value in to the cell when choosing a date from the component. It keeps the original value that was in the cell. I have implemented a setValueAt() method so I'm not sure why this is not fired, any ideas?? Code is below :
    public class DueDateTableModel extends AbstractTableModel {
        private Vector vAllDueDates = null;
        private Connection conn = null;
        private Statement stmt = null;
        private ResultSet rsDueDates = null;
        private int iColCount;
        private String sSqlDueDates = null;
        private String[] testColNames = null;
        public DueDateTableModel(int pColCount, Vector pAllDueDates, String[] pColNames){
            iColCount = pColCount;
            vAllDueDates = pAllDueDates;
            testColNames = pColNames;
            populateTableCells();
            //setupEditors();
        public int getColumnCount() {
            return iColCount;
        public int getRowCount() {
            return vAllDueDates.size();
        public String getColumnName(int iCol) {
              return testColNames[iCol];
        public Object getValueAt(int iRow, int iCol) {
            // TODO Auto-generated method stub
            Vector v = (Vector)vAllDueDates.elementAt(iRow);
            return v.elementAt(iCol);
        public void setValueAt(Object oValue, int iRow, int iCol) {
            Vector v = (Vector)vAllDueDates.elementAt(iRow);
            v.setElementAt(oValue,iCol);
            fireTableCellUpdated(iRow,iCol);
        public boolean isCellEditable(int iRow, int iCol) {
            if(getValueAt(iRow,iCol)==null){
                return false;
            }else{
                return true;
        private class DueDateEditor extends CalendarComboBox implements TableCellEditor{
            //protected EventListenerList listenerList = new EventListenerList();
            //protected ChangeEvent changeEvent = new ChangeEvent(this);
            public DueDateEditor(){
                super();
            public void removeCellEditorListener(CellEditorListener l){
                //listenerList.remove(CellEditorListener.class, l);
            public Component getTableCellEditorComponent(JTable table, Object value
                    , boolean isSelected, int row, int column){
                //Just return the input panel and not the panel that the calendar comboBox is on
                return this.inputPanel;
              public Object getCellEditorValue(){
                  return this.getDate();
              public boolean isCellEditable(EventObject evt) {
                //if (evt instanceof MouseEvent) {
                  //  return ((MouseEvent)evt).getClickCount() >= 2;
                return true;
              public boolean shouldSelectCell(EventObject anEvent){
                  return false;
              public boolean stopCellEditing(){
                  //this.setDate();
                  return true;
              public void cancelCellEditing(){
              public void addCellEditorListener(CellEditorListener l){
                  //listenerList.add(CellEditorListener.class, l);
              /*protected void fireEditingStopped() {
                  CellEditorListener listener;
                  Object[] listeners = listenerList.getListenerList();
                   for (int i = 0; i < listeners.length; i++) {
                         if (listeners[i] == CellEditorListener.class) {
                                listener = (CellEditorListener) listeners[i + 1];
                                listener.editingStopped(changeEvent);
        }Sorry the classes are quite basic, I'm not very familiar with custom cell editors, I have normally used default ones like combobox etc.
    Regards
    Alan

    To get better help sooner, post a SSCCE that clearly demonstrates your problem.
    To post code, use the code tags -- [code]Your Code[/code]will display asYour CodeOr use the code button above the editing area and paste your code between the {code}{code} tags it generates.
    luck, db

  • JQuery-Script only working when WebPart is in Edit Mode

    Hi there,
    so I developed some custom functionality with SPServices that works fine in my dev-environment. Now Im trying to deploy it in the productive environment and Ive struggled for several hours but cant get it to work.
    This is my code: http://pastebin.com/DvStqiet
    I insert the code inside of a simple form webpart.
    When the webpart / website is in edit mode, the code executes fine.
    When its not in edit mode, the jquery functions work, but the spservices functions do not seem to work. I get the error "Das Objekt unterstützt diese Eigenschaft oder Methode nicht." (in english its something like "The object does not support
    this property or method."). Line number of the error then points to the first occurrence of $.SPServices(). (Firefox Screenshot of Console: http://imgur.com/QvozF38)
    I searched nearly the whole Internet and tried different solutions.
    I wrapped the $(document).ready(function() {}) like this: ExecuteOrDelayUntilScriptLoaded(function() {}, "sp.js");
    And I tried writing the code directly to the webpart page via sharepoint designer. It does not work then either and I even cant enter edit mode.
    I found out, that the masterpage-Template is also referencing a jQuery-Instance (v 1.4.2), so I tried disabling the reference in my script, but the result is the same.
    I also tried referencing the scripts via absolute URLs, without success.
    The references to the scripts seem to work (I can click them in sharepoint designer). I just dont know why it is not working. If you have any further suggestions or have any idea how to tear this problem down, or find out whats maybe causing it, please let
    me know because Im really clueless right now...
    Thank you very much!

    OK it seems like I got it to work with the following:
    I just wrapped my entire code inside of
    (function($) {
        // Your usual jQuery code here using `$`,
        // this code runs immediately
    })(jQuery);
    and now it works. Im really happy, that it finally works... Seems like some other javascript (maybe referenced by the master template?) is overwriting the $.

  • In Edit mode the image gets distorted as if a graphics card error...

    When I enter edit mode, many times the image gets distorted and is unrecognizable. The image is covered in red or green lines like when a driver or graphic card is having problems. I can view the image if I use the shift key or exit edit mode.
    Have the latest version of both OS and iPhoto. Am considering a complete reinstall of the OS and Software but would like to avoid if possible.

    Welcome to the Apple Discussions.
    Well you can avoid the hassle of re-installing because it won't help. This is a bug that affects some users of 10.6 and iPhoto, Aperture and/or Preview. Currently there is no solution.
    iPhoto menu -> Provide iPhoto Feedback
    and let them know that you too have the issue.
    Regards
    TD

  • Drag'n'Drop on Web Parts In Edit Mode Not Working When X-US-Compatible Is IE=11

    Hello,
    when the compatibility settings are above IE=10 the web parts cannot be moved between/within the web part zones.
    Steps I have done to reproduce this on clean environment:
    Created a new sharepoint publishing portal
    Tested on the default page that web parts can be moved in IE 11
    Downloaded the master page seattle from gallery
    Replaced the following line:
     <meta http-equiv="X-UA-Compatible" content="IE=10"/>
    with:
      <meta http-equiv="X-UA-Compatible" content="IE=11"/>
    Uploaded the master page to the gallery.
    Published major version.
    Entered edit mode on the default page.
    The web parts cannot be drag'n'dropped.
    Do you have any idea about a fix for this?
    Thanks.

    Every application can't come automatically configured to work with every other application, even if they're both from MS. Tweaks here and there are going to be required. If you go in and make a settings change and then everything works fine, I would call
    that "fully supported."
    Also, you WANT a solution that doesn't require IE changes, fine. But did you at least try and see if these changes affect anything? We need to at least do our due diligence in troubleshooting and root causing before we can ask for particular solutions my
    friend.

  • CellEditor does not end edit mode when finished editing

    I have a custom cell editor and it does not return from edit mode once the cell has been edited. Can anyone help ?

    Post your table cell editor code

  • New edit mode nodes

    Currently working with the nodes in Ai is embarrassing when I want a sharp change in the mild, mild in symmetrical or unsymmetrical try these changes lead to change in shape.
    I think it is perfectly solved in the blender. -
    Mark object - smite the TAB key and toggle the mode Edit nodes
    Now in this mode:
    - I am available keyboard shortcuts for quick changes in the type of node
    - the node type of change does not change shape if it allows a new node type
    - an expanded zone marking points of handles, it is easier to hit the point handles can also enter in this mode
    The ability to edit several obiects at once - in the end to add shortcuts to patchfinder The use of the Tab key to enter editing mode for me is very intuitive.
    What do you think?

    Then iPhoto has lost the connection between the thumbnails and the original files.
    Back up your iPhoto Library and rebuild it, see Old Toad's post here:
    Rebuild iPhoto Version 11

  • Problems loading Premier 11 edit mode.

    Have just downloaded Elements 11 and Premiere 11 Elements OK but cant enter Edit mode in Premier error message relates to Update Display Driver, current driver MS-GDI Generic 1.1.0, monitor is a Samsung Syncmaster T200.
    My system is an Acer Aspire M1610.
    Any help would be appreciated.

      Are you able to launch the program from the Organizer by clicking the Editor icon (at the bottom) and using the dropdown menu to choose Video Editor?
    If not, you may need to visit the website of the manufacturer of your graphics card and search for up to date driver downloads.
    See this Adobe tech note:
    http://helpx.adobe.com/premiere-elements/kb/display-driver-video-adapter-issues.html
    If you still need further help, there is a separate forum for Premiere Elements.
    http://forums.adobe.com/community/premiere_elements

  • Stopping cell editing in a JTable using a JComboBox editor w/ AutoComplete

    Hi there! Me again with more questions!
    I'm trying to figure out the finer parts of JTable navigation and editing controls. It's getting a bit confusing. The main problem I'm trying to solve is how to make a JTable using a combo box editor stop editing by hitting the 'enter' key in the same fashion as a JTextField editor. This is no regular DefaultCellEditor though -- it's one that uses the SwingX AutoCompleteDecorator. I have an SSCCE that demonstrates the issue:
    import java.awt.Component;
    import java.awt.EventQueue;
    import javax.swing.AbstractCellEditor;
    import javax.swing.JComboBox;
    import javax.swing.JFrame;
    import javax.swing.JTable;
    import javax.swing.WindowConstants;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.TableCellEditor;
    import javax.swing.table.TableModel;
    import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
    public class AutoCompleteCellEditorTest extends JFrame {
      public AutoCompleteCellEditorTest() {
        JTable table = new JTable();
        Object[] items = {"A", "B", "C", "D"};
        TableModel tableModel = new DefaultTableModel(2, 2);
        table.setModel(tableModel);
        table.getColumnModel().getColumn(0).setCellEditor(new ComboCellEditor(items));
        getContentPane().add(table);
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        pack();
      private class ComboCellEditor extends AbstractCellEditor implements TableCellEditor {
        private JComboBox comboBox;
        public ComboCellEditor(Object[] items) {
          this.comboBox = new JComboBox(items);
          AutoCompleteDecorator.decorate(this.comboBox);
        public Object getCellEditorValue() {
          return this.comboBox.getSelectedItem();
        public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
          comboBox.setSelectedItem(value);
          return comboBox;
      public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
          public void run() {
            new AutoCompleteCellEditorTest().setVisible(true);
    }Problem 1: Starting to 'type' into the AutoCompleteDecorate combo box doesn't cause it to start editing. You have to hit F2, it would appear. I've also noticed this behaviour with other JComboBox editors. Ideally that would be fixed too. Not sure how to do this one.
    Problem 2: After editing has started (say, with the F2 key), you may start typing. If you type one of A, B, C, or D, the item appears. That's all good. Then you try to 'complete' the edit by hitting the 'enter' key... and nothing happens. The 'tab' key works, but it puts you to the next cell. I would like to make the 'enter' key stop editing, and stay in the current cell.
    I found some stuff online suggesting you take the input map of the table and set the Enter key so that it does the same thing as tab. Even though that's not exactly what I desired (I wanted the same cell to be active), it didn't work anyway.
    I also tried setting a property on the JComboBox that says that it's a table cell editor combo box (just like the DefaultCellEditor), but that didn't work either. I think the reason that fails is because the AutoCompleteDecorator sets isEditable to true, and that seems to stop the enter key from doing anything.
    After tracing endless paths through processKeyBindings calls, I'm not sure I'm any closer to a solution. I feel like this should be a fairly straightforward thing but I'm having a fair amount of difficulty with it.
    Thanks for any direction you can provide!

    Hi Jeanette,
    Thanks for your advice. I looked again at the DefaultCellEditor. You are correct that I am not firing messages for fireEditingStopped() and fireEditingCancelled(). Initially I had copied the behaviour from DefaultCellEditor but had trimmed it out. I assumed that since I was extending AbstractCellEditor and it has them implemented correctly that I was OK. But I guess that's not the case! The problem I'm having with implementing the Enter key stopping the editing is that:
    1) The DefaultCellEditor stops cell editing on any actionPerformed. Based on my tests, actionPerformed gets called whenever a single key gets pressed. I don't want to end the editing on the AutoCompleteDecorated box immediately -- I'd like to wait until the user is happy with his or her selection and has hit 'Enter' before ending cell editing. Thus, ending cell editing within the actionPerformed listener on the JComboBox (or JXComboBox, as I've made it now) will not work. As soon as you type a single key, if it is valid, the editing ends immediately.
    2) I tried to add a key listener to the combo box to pick up on the 'Enter' key and end the editing there. However, it appears that the combo box does not receive the key strokes. I guess they're going to the AutoCompleteDecorator and being consumed there so the combo box does not receive them. If I could pick up on the 'Enter' key there, then that would work too.
    I did more reading about input maps and action maps last night. Although informative, I'm not sure how far it got me with this problem because if the text field in the AutoCompleteDecorator takes the keystroke, I'm not sure how I'm going to find out about it in the combo box.
    By the way, when you said 'They are fixed... in a recent version of SwingX', does that mean 1.6.2? That's what I'm using.
    Thanks!
    P.S. - Maybe I should create a new question for this? I wanted to mark your answer as helpful but I already closed the thread by marking the answer to the first part as correct. Sorry!
    Edited by: aardvarkk on Jan 27, 2011 7:41 AM - Added SwingX versioning question.

Maybe you are looking for

  • Why will my photos only print in black and white?

    My computer crashed a while ago and I had to re-install my photoshop elements 6. Since then, photos will only print in black and white through elements, even though they'll print in colour through other programs on my computer. This must be a setting

  • Report Painter in FI/CO

    Hi All, While creating a row in report painter,i have selected character and created a row gross sales.Now if i would like to assign a formula how do i do it. Regards Saras

  • Photoshop Elements 9 plug in and Aperture 3

    I recently loaded Photoshop Elements 9 (for Mac).  I had expected the plug-in to appear automatically in the Aperture 3 pull down menu.  Obviously I have done something wrong.  But what?  Advice please

  • Condition type of taxinn

    hi, i have created one condition type of BED whose calculation type is Quantity,so while maintaining condition record of that condition type sytem ask mi currency & unit of measure  i.e inr &  EA , now my question is if suppose material base unit of

  • How weird is this?  InDesign CC drops 20 of my CS6 Myriad Pro sub-fonts!

    Well, I'm  narrowing it down, so I deleted two earlier posts.  It AIN'T Windows 7, and I don't think it's lack of updating Creative Cloud, since I rebooted after that... In InDesign CS6 all 32 sub-fonts under Myriad Pro show up, and are usable. If I