|
|
Custom Tab order within a JTable
Hi,
I have a JTable instance with two columns and certain number of
rows. The first column (on the left) lists the property name and right
column lists the value of the corresponding property. The property
values are editable (by the user) whereas the property names are not.
The default tab order takes a right/down approach. However I wish that
as the tab is pressed, only the editable fields (i.e. the right column
stack) get focus.
To be clear, I want the tab order to be
cell(0,1) -> cell(1,1) -> cell (2,1) ... cell(0,1) ... where
cell(ROW,COL) is the cell at the intersection of row ROW and col COL.
Do you know how is this possible. I know that the tab order can
be set for different components, but I dont know how to do it within a
JTable. Can you please help me out.
Thanks in advance,
Mahim.
|
|
0
|
|
|
|
Reply
|
absletters
|
10/11/2004 8:07:12 PM |
|
Mahim wrote:
> Hi,
>
> I have a JTable instance with two columns and certain number of
> rows. The first column (on the left) lists the property name and right
> column lists the value of the corresponding property. The property
> values are editable (by the user) whereas the property names are not.
> The default tab order takes a right/down approach. However I wish that
> as the tab is pressed, only the editable fields (i.e. the right column
> stack) get focus.
> To be clear, I want the tab order to be
>
> cell(0,1) -> cell(1,1) -> cell (2,1) ... cell(0,1) ... where
> cell(ROW,COL) is the cell at the intersection of row ROW and col COL.
>
> Do you know how is this possible. I know that the tab order can
> be set for different components, but I dont know how to do it within a
> JTable. Can you please help me out.
>
> Thanks in advance,
> Mahim.
You can write your own Action classes that performs the appropriate cell
navigation and link those Actions to the keys "selectNextColumnCell" and
"selectPreviousColumnCell" in the ActionMap of the table. (These are the
strings that map to Tab and Shift-Tab keys respectively in the default
InputMap of a JTable).
If you do not want to rely on this implementation detail, you can modify
the InputMap of the JTable to map the Tab / Shift-Tab keystrokes to some
other string values, and map those strings to your custom actions in the
ActionMap.
BK
|
|
0
|
|
|
|
Reply
|
Babu
|
10/13/2004 6:40:50 AM
|
|
|
1 Replies
794 Views
(page loaded in 0.009 seconds)
Similiar Articles: JTable, edit a cell, but changed value not seen - comp.lang.java ...... up when you edit a cell but don't tab ... trying to get the values from a JTable inside an ... ... font for particular cell in JTable - comp.lang ... Unexpected sort order when ... Changing color of a selected cell in JTable - comp.lang.java.gui ...Anyway i have implemented it by creating a custom cell ... I am also handling the TAB key event to change the ... ... Set size of JTable inside a JScrollPane - comp.lang.java ... Sorting JTable with fixed column - comp.lang.java.guiI think you would need to write a custom ... How JTable restore original order after sorting? - comp.lang.java ... ... Set size of JTable inside a JScrollPane - comp.lang ... JTable, aligning text - comp.lang.java.guiBy default, if your value inside table cell is ... to find some tuorials about implementing custom renderers for JTable on ... to right align numbers in ... to a decimal tab ... Using native cut copy paste in JTable - comp.lang.java.gui ...Hello everybody, I am trying to implement a JTable with support of cut copy paste ... into the Windows clipboard in the correct Excel format (columns separated with TABs ... Disable a JTable row - comp.lang.java.guiIn order to not being able to edit, return false from isCellEditable ... Disable a JTable row - comp.lang.java.gui Custom tooltip renderer in JTable - comp.lang.java.gui ... Problems with JTable using fixed rows - comp.lang.java.gui ...hi, I have a special table setup in order to get ... be difficult to construct if you have a lot of custom ... Set size of JTable inside a JScrollPane - comp.lang.java ... go to a TAB - comp.databases.filemaker... won't take a name, use the name of an object inside the tab ... tab order - comp.databases.filemaker pdf995 and embedded ... Cell focus in JTable - avoid focus on non-editable ... JScrollPane doesn't scroll a JPanel? - comp.lang.java.gui ...... containing a JTabbedPane, each tab of ... Hi,I'm inserting a JTable into a JScrollPane which is inserted inside aJPanel. ... JScrollPane doesn't want to scroll custom ... How to prevent JPanel losing focus ? - comp.lang.java.gui ...... JPanel losing focus (like switching to another tab ... I want the behaviour to be within the panel. Your example ... Products, Roedy Green. http://mindprod.com Java custom ... How to Use Tables (The Java™ Tutorials > Creating a GUI With JFC ...With the JTable class you can display tables of data ... The custom table model implemented in TableDemo does not ... In order to fire data change events the table model must ... Java tab order: How to set Tab order in java swing table - Stack ...I am new to the java language and I want to set tab order in JTable in java swing. ... http://compgroups.net/comp.lang.java.gui/Custom-Tab-order-within-a-JTable 7/23/2012 5:45:35 PM
|
|
|
|
|
|
|
|
|