How to Disable Focus in a JTable Cell

Written by greg lindberg
  • Share
  • Tweet
  • Share
  • Email

When you are working with Java code to create a table you can use the Jtable cell selection component for selecting cells within a table. To disable a selection in a table you must use the set Focusable(false) component. Once you add the false portion to the focus component then the table you've created will no longer have the selection capability. The process for disabling the focus in the JTable cell can be accomplished by editing your code in a plain text file.

Skill level:


  1. 1

    Open the plain text file that contains the Java code you want to edit. For example, if the code you want to disable focus for is stored in a Notepad file then open the Notepad file.

  2. 2

    Press the "CTRL" and "F" keys on your keyboard and then enter "table.setFocusable" into the text box.

  3. 3

    Press the "Enter" key on your keyboard and then view the "table.setFocusable" component to make sure it reads, "table.setFocusable(true)" in your text file.

  4. 4

    Use your mouse to highlight the "true" portion of the component and then enter "false" into the parenthesis.

  5. 5

    Click the "File" option in the Notepad application and then click the "Save" option. The focus component selection will be fully disabled.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.