Column CellEditor to dynamically show a button and a text field.

I am a Java Swing developer and wondering if it is possible to set Table or Grid cell editor to show a button at the right side of the column to let user click and display a selection pop-up table in addition to textfield inside the same column. I have a similar interface that I have developed in JTable. The same column is good for entering value directly insteaed of using the button simultaneously.

I have following codes to initiate the cell editor:

        //Showing icon button in the Project table column
        JTextField textField1 = new JTextField();
        DefaultCellEditor editor1 = new DefaultCellEditor(textField1);
        table.getColumn(table.getColumnName(10)).setCellEditor(new PssProjectTableCellEditor(editor1, dbConnection));

Comments are welcome.


I didn’t exactly understand what you want. A text field + button that pops up a selection table sounds a lot like a ComboBox. In any case, you can always create composite fields with the CustomField component.

It`s not something like ComboBox! The text field will remain always editable but an option button inside the cell will be there to initiate popup window if needed. Please see the attached images:

  1. Cell editor1.png: Before you select the cell, no specific editor is visible
  2. Cell editor2.png: When you move your cursor in the respective cell, you can type anything but at the same time a button is appeared at the right side of the cell (inside) as an option to select.

Any thought about the possible solution?


Ok, so in that case perhaps a CustomField with a TextField and a popup button of some sort might be what you are looking for. In Table, you can make the button appear/disappear with a FocusListener and BlurListener. In grid you don’t really need that, as editor fields are anyway shown only for the item under editing.

That is what I have done in my Swing application as shared by snapshot. I am very new to Vaadin/web application and not sure if it is possible to achieve in Vaadin. Any support will be appreciated