JavaFX2.2 TableView:How to make a table cell be edited without mouse click?

Hi,
I've encounter a problem with editable table cells. I'm using the TableView in my project just as the Tutorial on Oracle (http://docs.oracle.com/javafx/2/ui_controls/table-view.htm).
According to it, I use the setCellFactory method to reimplement the table cell as a text field with the help of the TextFieldTableCell class. However, I found the steps is a little complex to get to the point where the cell can be edited:
1.Let the table cell be selected by using direction key.
2.Press “Enter” to converts the cell to a text filed so that it is ready to be edited.
3.Clicking in the text field allows the contents to be edited
The problem is step 3, that you must use the mouse to click before you can input data in this table cell.
So, is there a solution to avoid step 3? That is the text field allows the data inputting when you just press “Enter”(step 2).
By the way, English is not my native language. Hope I have made myself clear.

Hi,
You need to pass the focus to the text field when the startEditing event occurs. In the class that extends TableCell you use for cellFactory:
public void startEdit() {
super.startEdit();
createTextField();
setText(null);
setGraphic(textField);
* put focus on the textfield so user can directly typed on it
Runnable r = new Runnable() {
@Override
public void run() {
getGraphic().requestFocus();
Platform.runLater(r);
}

Similar Messages

  • How to make a table column block editable for a row and remain non editable for other row based on some condition

    hi ,
    i need help on the below scenario ,
    we have a web dynpro table with different columns, now based on new business requirement  one of the column need to     
    dynamically editable or non editable for different row.
    for ex :
    Field 1
    Field 2 ( Dynamic field )
    Field 3
    Field 4
    Data 11
    Data 12 ( Editable with Drop down   )
    data 13
    data 14
    Data 21
    Data 22 ( Non editable )
    Data 23
    data 24
    Data 31
    data  32 ( Editable with drop down )
    data 33
    data 34
    how to achieve this ? please help on this.
    Thanks in advance
    Thanks
    Manish

    Manish,
    there is no proper way to insert two Cell Editors in a column(except variants), have a look on below scenario, it may help.
    add one more attribute to your table context node for read-only.
    create dropDown as celleditor for table and bind with newly created attribute to read-only property of dropdown.
    before binding data to table, check the condition then mention readonly value abap_true / false.
    @ we can achieve by the use of Variants.
    for ex :
    Data 11
    Data 12 ( Editable with Drop down)
    data 13
    read-only - abap_false
    Data 21
    Data 22 ( Non editable, dropdown )
    Data 23
    read-only - abap_true
    Data 31
    data  32 ( Editable with drop down )
    data 33
    read-only - abap_false

  • How to Make a Table control Field Editable but input disabled

    Hi All,
        I got a requirement that in table control one column should be in edit mode (i.e. input enabled) but user should not be able to type anything in that field or column rather he can select the value from F4 help (or pick list) associated with that field or column. How to do this ? Please dont say make sceeen-input = 0 for that field.
    Experts please help me out...........
    Thankx in Advance
    Rizwan Ahmad Siddiqui

    Hi,
    I suggest you to go for a drop down instead of a search help.
    Regards,
    Charumathi.B

  • How can I make a table cell extend beyond the page?  The text disappears when the cell becomes larger than the page.

    How can I make a table cell extend beyond a page?  The text disappears when the cell becomes bigger than the page.  I want the table to continue to the next page.

    As a student, you might be able to get Office for Mac from the college bookstore at a substantial discount. Otherwise, I think your best option for documents that need to be shared with Office users is to get one of the free Office clones such as LibreOffice.

  • How to enable a table cell dynamically?

    Hi
    I have a javafx TableView with editable and non-editable columns. I have set editable columns CellFactory to a custom EditableTextCell.This makes the whole column editable on load of the Scene.
    I have one more requirement for the same table. I have to make the table cell editable at runtime based on a flag in item mapped to tablerow. Only a single row cell should get editable not all the cells in column. How to do that? Please suggest.

    Perhaps something like this
    create or replace view v_myview
    as
    select id, name, 'table1' as tbl_nm from table1
    union all
    select id, name, 'table2' from table2
    union all
    select id, name, 'table3' from table3
    union all
    select id, name, 'table4' from table4
    select name
      from v_myview
    where id = 101
       and tbl_nm = :P101_TABLE_NAME;

  • How to make the table scalable inside a tap control?

    Hi,
    Does anyone know how to make the table scalable inside a tap control in LabWindow CVI? I see that there is option for a panel to scale contents on resize, but not available for a tab control. Any ideas?
    Thanks a lot!
    Weiming
    Solved!
    Go to Solution.

    Hi SGIE,
    you have posted a LV-related question to the LabWindows/CVI forum: you should post it in the LabVIEW forum instead.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • How to make stork table in Mac numbers

    hello,
    how how to make stork tables in numbers just as what we can creat in windows excel?
    thank you

    Another way to create this type of chart is to create the pieces in separate charts and then layer them. 
    You create two stacked bar charts.  There are two rows of values in each.  The color of the bottom value is set to "no fill" to create the floating bar effect. 
    The width of the stick bar is changed by setting the gap to the maximum allowable (999%).  The "stick" chart is placed behind the other.
    For this to work, they need to be the exact same size and with the same axis values.  Setting the axis to have fixed values makes this easier.  Also, it improves the appearance to limit all the axis labels and lines to be in just one of the charts.

  • Well how I make Rounded Table Corners (html) ?

    I use dmwr mx 2004 , well how I make Rounded,Table,Corners
    (html) ? CSS TABLES can be with Rounded Corners ?

    On Wed, 12 Dec 2007 16:40:01 +0000 (UTC), "123polis123"
    <[email protected]> wrote:
    >I use dmwr mx 2004 , well how I make
    Rounded,Table,Corners (html) ? CSS TABLES can be with Rounded
    Corners ?
    No - you have to use images.
    as already said - just google for more info
    http://www.google.co.uk/search?hl=en&q=round+corners+on+websites&btnG=Google+Search&meta=
    ~Malcolm N....
    ~

  • HOw to make an Object oriented alv respond to double click

    Hi all,
    HOw to make an Object oriented alv respond to double click.SAmple code will be helpful.
    Thanks in advance,
    Alex.

    Hi,
    1. Create a Control (for Custom and Split Containers only)
    2. Instantiate a Container Object (in case of Custom and Split Containers, specify the control which is created by us in Screen painter) CREATE OBJECT
    3. Instantiate an Object of the kind of report that has to be displayed (List, Grid or Tree). CREATE OBJECT . Here we need to specify the Parent Container as the so that it sits in that container.
    4. Call appropriate methods to display the report on the screen. CALL METHOD ->
    DATA : g_dock TYPE REF TO cl_gui_docking_container,
    g_split TYPE REF TO cl_gui_easy_splitter_container,
    g_cont1 TYPE REF TO cl_gui_container,
    g_cont2 TYPE REF TO cl_gui_container,
    g_grid1 TYPE REF TO cl_gui_alv_grid,
    g_grid2 TYPE REF TO cl_gui_alv_grid.
    i_mara is an internal table of structure MARA
    SELECT * FROM mara INTO TABLE i_mara.
    i_kna1 is an internal table of structure KNA1
    SELECT * FROM kna1 INTO TABLE i_kna1.
    To create an Object of type Docking Container
    CREATE OBJECT g_dock
    EXPORTING
    side = cl_gui_docking_container=>dock_at_top
    extension = 200 .
    To Create an Object of Type Split Container. Here we can see that the Docking *Container Created above has been used as a parent .
    CREATE OBJECT g_split
    EXPORTING
    parent = g_dock
    orientation = 1 .
    Easy Split container splits one Control into 2 manageable controls, each of them is used * to handle one GUI Container each
    g_cont1 = g_split->top_left_container.
    g_cont2 = g_split->bottom_right_container.
    To Create an Object of type Grid . Here we can see that the Left Split Container * Created above has been used as a parent .
    CREATE OBJECT g_grid1
    EXPORTING
    i_parent = g_cont1 .
    To Create an Object of type Grid . Here we can see that the Right Split Container * Created above has been used as a parent .
    CREATE OBJECT g_grid2
    EXPORTING
    i_parent = g_cont2 .
    The method of Grid Control Object is used to display the Data.
    CALL METHOD g_grid1->set_table_for_first_display
    EXPORTING
    i_structure_name = 'MARA'
    CHANGING
    it_outtab = i_mara[] .
    The method of Grid Control Object is used to display the Data.
    CALL METHOD g_grid2->set_table_for_first_display
    EXPORTING
    i_structure_name = 'KNA1'
    CHANGING
    it_outtab = i_kna1[] .
    Regards
    Hari

  • How to post a table/set of records without losing formatting while posting

    how to post a table/set of records without losing formatting while posting in this message forum. Thanks

    Most forums have a FAQ. This one is no exception.
    It is in the right hand upper corner. It's URL is http://wikis.sun.com/display/Forums/Forums+FAQ
    Sybrand Bakker
    Senior Oracle DBA

  • How to apply a table cell style based on grep search?

    Anyone that know how to make a script that searches in an Indesign table for
    -> All cells where the text starts with "Banana"
    -> And apply cell style "Yellow" to these cells?
    I have been searching on forums for somedays and got this tip: https://github.com/seuzo/regex_cellstyle/blob/master/regex_cellstyle.jsx
    -> But that script is in japanese and also use dialogs.
    All help most appriciated!

    Hi Frankeman,
    Please try the below code, may it should be helpful:
    var myDoc = app.activeDocument
    app.findTextPreferences = app.changeTextPreferences = null
    app.findTextPreferences.findWhat = "Banana"
    var myFound = myDoc.findText()
    for(i=0; i<myFound.length; i++)
        if(myFound[i].parent.constructor.name == "Cell")
       myFound[i].parent.appliedCellStyle = "Yellow"
    Suppose the code is working fine for you, then please click correct answers.
    thanks
    Beginner_X

  • How to create a table cell occupy more than one row using PDF.

    Hi,
    I want create a pdf report,which contains a table cell occupied more than one line.
    just like html language: <rowspan = 2>
    merge cells in one row is allowed,we can use merge cells command(like colspan in html).
    but how to mege cells in one column?

    Hi,
    I want create a pdf report,which contains a table cell occupied more than one line.
    just like html language: <rowspan = 2>
    merge cells in one row is allowed,we can use merge cells command(like colspan in html).
    but how to mege cells in one column?

  • How to link a table cell?

    Hi,
    What would be the best way to link this table cell? I want the entire cell to be linked rather than just the text inside it.
    <table width="160" border="0" align="right" cellpadding="5" cellspacing="0" class="backgroundbox-video">
                          <tr>
    <td width="167" align="left" valign="top"><p class="navheader-lg">Video Clip</p>
                                <p class="navheader-sm">Watch a short<br />
                                  testimonial video</p></td>
                          </tr>
    Thanks so much
    Laura

    Here is what I have in the style sheet...
    .vidA a {
        text-decoration: none;
        display:block;
        background-image: url(../images/videoclip-imageandcolor-tr.gif) no-repeat scroll right bottom;
        background-color:#B1D6D5;
        padding:10px;
    .vidA a:link, .vidA a:visited, .vidA a:hover{
        color:black;
    .vidA a:hover{
        background-color:#4AA3C9;
    .vidA p {
        margin:5px;
    .audioA a {
        text-decoration: none;
        display:block;
        background-image: url(../images/audioclip-imageandcolor-tr.gif) no-repeat scroll right bottom;
        background-color:#B1D6D5;
        padding:10px;
    .audioA a:link, .vidA a:visited, .vidA a:hover{
        color:black;
    .audioA a:hover{
        background-color:#4AA3C9;
    .audioA p {
        margin:5px;
    and here is what I have for those tables...
    <td align="right" valign="top" bgcolor="#FFFFFF"><table width="160" border="0" align="right" cellpadding="5" cellspacing="0" class="backgroundbox-video">
                          <tr>
                            <td class="vidA" width="167" height="100" align="left" valign="middle"><a href="http://www.12results.com/video1.html" onclick="MM_openBrWindow('http://www.12results.com/video1.html','','width=400,height=400');return false">
          <span class="navheader-lg">Video Clip</span><br />
          <span class="navheader-sm"><br />
          Watch a short<br />
          testimonial video</span></a></td>
                          </tr>
                        </table></td>
                      </tr>
                      <tr>
                        <td align="right" valign="top" bgcolor="#FFFFFF"><table width="160" border="0" align="right" cellpadding="5" cellspacing="0" class="backgroundbox-audio">
                          <tr>
                            <td class="audioA" width="167" height="100" align="left" valign="middle"><a href="http://www.12results.com/video1.html" onclick="MM_openBrWindow('http://www.12results.com/video1.html','','width=400,height=400');return false"> <span class="navheader-lg">Audio Clip</span><br />
                                  <span class="navheader-sm"><br />
                                  Listen to a 40 min<br />
    interview about SAW</span></a></td>
                          </tr>
                        </table></td>
    ---I completely removed the styles for those tables (was background-video, background-audio) because all it had was the background styling (which you said to remove) and can't see any other reason to have it there?
    So it's perfect except for the background images are not showing...so did I do something wrong in the fireworks/make transparent process do you think?
    Thanks...
    Laura

  • How to make a table in java without using GUI??

    how can i make a table in java without usinf GUI, just simple codes??
    NAME ID NUMBER ADDRESS STATUS

    If you simply want to store them internally, you don't want to use a table.
    Make a simple class with properties id, name, number, address, status. Then create a Hashtable that indexes instances of the class by id or some other property.

  • How to make a table color or back ground image go on forever

    How do I make a table go on forever (to the right)? I know
    you can edit the size of the table, but if you make it larger than
    your own computer screen it makes you have to scroll left and
    right. I want to know how do I make a table go on forever with out
    making someone with a small screened computer have to scroll left
    and right.
    Thanks.,

    You can't. What is it you are trying to accomplish?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "-Michael--" <[email protected]> wrote in
    message
    news:eddbh5$a45$[email protected]..
    > How do I make a table go on forever (to the right)? I
    know you can edit
    > the
    > size of the table, but if you make it larger than your
    own computer screen
    > it
    > makes you have to scroll left and right. I want to know
    how do I make a
    > table
    > go on forever with out making someone with a small
    screened computer have
    > to
    > scroll left and right.
    >
    > Thanks.,
    >

Maybe you are looking for