CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2012
    Location
    Bangalore
    Posts
    3

    How to get Focus to the cell in JTable, when its cells are rendered and edited?

    The table i am using has combobox, Datepicker, RadioButtons, etc in the cells. When i am navigating inside table, i wont be able to know, in which cell i am. Focus is not visible. Tried,
    table.setCellSelectionEnabled(true);
    table.changeSelection(0, 1, false, false);
    table.setColumnSelectionInterval(0, 0);
    table.setRowSelectionInterval(0, 0);
    table.requestFocus();
    But nothing is getting focus in cell. Please help me out.

  2. #2
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: How to get Focus to the cell in JTable, when its cells are rendered and edited?

    The way I've done it in the past is:

    Code:
    table.changeSelection(row, column, false, false);
    table.requestFocus();
    Remembering to configure cell selection when you create the table using:

    Code:
    table.setCellSelectionEnabled(true);
    If this doesn't work you'll need to show more code so I can see what you are doing.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  3. #3
    Join Date
    Aug 2012
    Location
    Bangalore
    Posts
    3

    Exclamation Re: How to get Focus to the cell in JTable, when its cells are rendered and edited?

    Hello keang, thanks for ur reply. I tried the same thing which u hav mentioned, and also those things whic i specified in my 1st thread. Seems nothing working. No more extra code in my code Don't kno wat else sud i do.

  4. #4
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: How to get Focus to the cell in JTable, when its cells are rendered and edited?

    Can you post a runnable code example that demonstrates the problem you are having.
    What version of Java are you using?
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  5. #5
    Join Date
    Aug 2012
    Location
    Bangalore
    Posts
    3

    Re: How to get Focus to the cell in JTable, when its cells are rendered and edited?

    I am using JDK1.6 , Code is integrated and linked wit other code, which is confidential to project. Sorry..

  6. #6
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: How to get Focus to the cell in JTable, when its cells are rendered and edited?

    I didn't ask for your project code, I asked you to post some example code that demonstrates the problem ie a simple class that display a JTable and instructions on how to use it to show the issue you are having.

    If you can't post any code to show how you are configuring and using the JTable then it's going to be hard to help you further.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured