Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / February 2005

Tip: Looking for answers? Try searching our database.

How to request focus for DefaultTableCellRenderer?

Thread view: 
Stephan Collet - 11 Feb 2005 09:01 GMT
How can I request the focus for a specific cell of a table?

This code does not work:

((DefaultTableCellRenderer)table.getCellRenderer(row,column)).requestFocusInWindow()
(returns false)

Btw.:

((DefaultTableCellRenderer)table.getCellRenderer(row,column)).isDisplayable()
returns false and

((DefaultTableCellRenderer)table.getCellRenderer(row,column)).isVisisble()
returns true...

Thanks in advance,
Stephan Collet

Signature

Viele Grüße,
Stephan Collet

Walter Probst - 11 Feb 2005 11:08 GMT
> How can I request the focus for a specific cell of a table?

You need to set the row and column selection anchor.

jTable.getSelectionModel().setAnchorSelectionIndex(selectedRow);
jTable.getColumnModel().getSelectionModel().setAnchorSelectionIndex(selectedColumn);
Babu Kalakrishnan - 12 Feb 2005 04:03 GMT
> How can I request the focus for a specific cell of a table?
>
[quoted text clipped - 10 lines]
> ((DefaultTableCellRenderer)table.getCellRenderer(row,column)).isVisisble()
> returns true...

A JTable is a single component (at least when it isn't editing), and the
"focus" concept does not work at a cell level since each cell is not a
child component of the table.

The nearest thing you could do is what another poster suggested - i.e.
set the cell you want as the selected cell in the table.

BK


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.