Custom Tab order within a JTable

  • Permalink
  • submit to reddit
  • Email
  • Follow


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

See related articles to this posting

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
comp.lang.java.gui 8292 articles. 14 followers. Post

1 Replies
1141 Views

Similar Articles

[PageSpeed] 42

  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

Custom tab traversal order?
Good morning, I'm trying to build the UI of one of my little Python programs with wxGlade, and sometimes the tab order is "weird". Is there any way to change it? Thanks in advance, -- Silvio Moioli www.moioli.net silvio at moioli dot net "Things should be as simple as possible, but not any simpler" Einstein --------------------------------------------------------------------- To unsubscribe, e-mail: wx-users-unsubscribe@lists.wxwidgets.org For additional commands, e-mail: wx-users-help@lists.wxwidgets.org Hi, these methods might help: ...

Issue with TAB key in Custom Rendered JTable
Hi, I have a JTable(columns = 1) with custom rendered cells. Each row is a JPanel which contains a number of JLabels, JTextBoxes, JPanel (for image) and some JComboBoxes. I have TAB thru some of the textboxes and comboboxes. I am able to get the Focus to the table, but after that the TAB key doesnt work. Can anyone suggest me how I should go about this to make it cycle thru all the textboxes in the row and TAB into the subsequent row when it is the last item in the previous row and finally tab out of the table when all the rows are exhausted. Any help or pointers would be sincerely apprecia...

tab order screwed up even after tab order selected
After I select row order on the page, the page still opens with the cursor positioned on a lower field that I added, a bracket I added that is read-only. Once I start tabbing thru the doc, it acts like it is normal again and tab does not stop on that bracket. A cursor still hangs on that bracket until I tab below it and then it disappears and all is normal. Any ideas? I want the cursor to start at the top, not this bracket. thanks ...

JTables within a JTable
Hi all, I've used JTables with renderers before, but I've never tried this particular task. I'd like to have a JTable whose cells contain JTables. (I've tried other approaches, including JSplitPane, but none did exactly what I was looking for.) Creating the array of JTables isn't a problem and I can put them into a JTable without Java producing an error, but they're not being rendered properly. I tried creating a renderer (and changing the color just to make sure *something* was working right), but all I get is one red cell for each table, each cell about ...

tabbing order in tab controls
Hi How can I set the tabbing order of controls in a tab control on the front panel when having several other controls on the front panel. Right-click on the tab and select "Reorder controls In page" from the menu that pops up. This is not exactly what I meant. When I'm creating a local variable I can choose its destination (right-click - select item). Because there are so many I would like to reorder the tabbing order to choose the correct on the top. All this action are taken in the block diagramm. From the edit menu, select Set Tabbing order changing the tabbing order will ...

TAB to navigate in tab order
Hi, in wxWindows looks like pressing the Tab key on the last widget in tab order does not switch the focus to the first widget in tab order. Example: Tab order is - widget1 - widget2 - widget3 When widget3 has the focus, pressing Tab doesn't move the focus to widget1. How could this be done, however? Regards, Cristina. --------------------------------------------------------------------- Please read http://www.wxwindows.org/mlhowto.htm before posting. To unsubscribe, e-mail: wx-users-unsubscribe@lists.wxwindows.org For additional commands, e-mail: wx-user...

Tab order
>From the dev guide and older threads the only way I can see to set the tab order is by the control order. But what if I want some odd tab order that's different from the control order? For example, if I use a tabpanel, which the control order is very specific in RB or else all the controls get screwed up. So I have all my controls working on the tabpanel but I want my own tab order. Any way to do this? It seems like there should be an option to make a custom order, regardless of the control order.....or maybe I'm missing something. In article <1105575553.895968.164450...

Tab order in Tab Control
Hey, I have a modeless dialog (as the main window) which contains a tab control. For each tab I have a child window. My problem lies in tabbing through the controls. As of now I can only tab through the controls in the main dialog. That is, the only control here is the tab control. What I want to achieve is to be able to tab through the controls on the current active tab's page. Any idea on how to do this? Thanks! Soren Dreijer wrote: > My problem lies in tabbing through the controls. As of now I can > only tab through the controls in the main dialog. Th...

Custom Tags within Custom Tags.
I have a custom tag that spits out struts-html tags. The problem is that the struts tags are not being interpreted. I think that the interpretation is only happening once, how do I get JSP to interpret both my custom tag and the struts tags contained in my custom tag. Thanks in advance "Ranganath" <stranganath@yahoo.com> wrote in message news:50878eb2.0310161539.6fbb8305@posting.google.com... > I have a custom tag that spits out struts-html tags. The problem is > that the struts tags are not being interpreted. > I think that the interpretation is only happening once,...