Selective focus of cells in table
1 posts in topic
Flat View  Flat View

Posted By:   Anuradha_Saravanamuthu
Posted On:   Tuesday, January 29, 2002 11:22 PM

Hi all,
I am having a table of 4 columns. While tabbing through, i want the columns 3,4 are to be selected and not the 1,2. How to do that?

Right now, i put the code in isCellEditable() method

but 1,2 column gets focus then transfer happens. Any solution for avoiding the 1,2 column tab movement.


thanx in advance.


Re: Selective focus of cells in table

Posted By:   Anonymous  
Posted On:   Friday, February 1, 2002 05:10 AM

You can create a renderer for your table, that returns a JLabel component that is disabled for the concerned columns.
Ex for disable selection when value is null :

public Component getTableCellRendererComponent(JTable table,

Object value,

boolean isSelected,

boolean hasFocus,

int row,

int column) {

JLabel requestedComponent;

if (value==null || value.equals(null) || value.equals("")) {

requestedComponent = new JLabel();


else {

requestedComponent = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);


return requestedComponent;

About | Sitemap | Contact