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 8296 articles. 15 followers. Post

1 Replies
1307 Views

Similar Articles

[PageSpeed] 22


  • 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 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 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 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...

Re: tabbing order in tab controls
Is there a way to change the tabbing order without having the order on a list or local change also? I didn't take that into account when making the program, should have ordered all the control before wiring it all up :-/ Hi leachdor,When you change the tab order of a specific control in LabVIEW, it must then re-order the other controls in order to ensure that each tab order value is only applied to one control, and that there are only as many tab stops as there are controls.&nbsp; As such, there is no way to simply re-order a single control without modifying other controls. Hi and th...

Tab order on multirow tab control
Is there a way to stop the default action of a multirow tab control whereby the row with focus moves to the front of the tabs? I find this behaviour annoying and confusing to the user and am at a loss as to why MS has designed their tab controls like this. Wayne wrote: > Is there a way to stop the default action of a multirow tab control > whereby the row with focus moves to the front of the tabs? I find > this behaviour annoying and confusing to the user and am at a loss as > to why MS has designed their tab controls like this. ALL multi-row tabs act this way. How else can y...

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,...

Tab Control
Hi, all! &nbsp; I would like to customize Tabs on the Tab Control. More exactly - I would like to add bevels to the tabs as shown below: &nbsp; <img src="http://vi-lib.com/forForum/TabControlwithBevel.jpg"> &nbsp; Is it theoretically possible? May be&nbsp;some workarounds exists? &nbsp; with best regards, &nbsp; Andrey. Hi, TiTou, This requirement coming from corporate UI Guidelines, where shapes of Tabs strongly predefined. I can do required "skinning" for most controls which can be customezed, but unfortunately not for Tab Control... Andrey...

Re: TAB to navigate in tab order
Bob Davis wrote: >In my case where I didnt have a message pump I put the following in the >app implementation and it fixed it: > >BEGIN_EVENT_TABLE(MyApp, wxApp) > EVT_CHAR(MyApp::OnChar) >END_EVENT_TABLE() > >void MyApp::OnChar(wxKeyEvent& event) >{ > if ( event.GetKeyCode() == WXK_TAB) { > wxNavigationKeyEvent eventNav; > eventNav.SetDirection(!event.ShiftDown()); > eventNav.SetWindowChange(event.ControlDown()); > eventNav.SetEventObject(event.GetEventObje...

Tab control within another tab control
I am creating a form with a tab control containing 10 tabs. and what I want to do is on only on of the tabs, I want a sub section of tabs. So what it ends up being is one main tab control with another tab control embedded into only one of the tab pages. The problem I am getting is when I insert the sub section tab control into one of the tabs from the main tab control, the sub section tab control appears in every tab in the main tab control. Can anyone help? What do I need to do so it only appears in one tab, not all. Thanks As you found, you cannot place a tab control on one of the pages...

Tab into JTable with one tab instead of two?
Tabbing into a JTable only almost works; the first time you hit tab from the immediately prior component the cursor just disappears, and it takes a second tab to get it into the JTable. I've found out that Swing thinks the focus is in the JTable even after first tab, so JTable is somehow hiding the focus in limbo until you say "no, I _really_ want the focus to be in you", so to speak. There's a simple example that replicates this bug here (don't even need to use custom focus traversal, shows up with normal): http://java.sun.com/docs/books/tutorial/uiswing/misc/foc...

Re: TAB to navigate in tab order #2
Hi, I got to the source of the problems: my wxNotebook was placed directly on a wxFrame. So folks, never do this, or you'll get focus switch disorders. Instead, whenever you make a wxFrame, place a wxPanel firstly on it, then place whatever else you might need (a wxNotebook in my case). Cheers, 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-users-help@lists.wxwindows.or...

Names of textboxes on tab-pages within a tab control?
I have a tab control named TabCtl210. It has 3 tabs. named Page211, Page212 and Page213. Each of those 3 tab-pages has a textbox control named Page1HomeSpot, Page2HomeSpot and Page3HomeSpot respectively. I got an error #2109: "There is no field named Page1HomeSpot in the current record" There's only one line of code in the entire form module that references the control: Private Sub Page1() DoCmd.GoToControl ("Page1HomeSpot") End Sub Under what circumstances would Access give em this error? Try: Me.Page1HomeSpot.SetFocus If that still fails, and you are certain...

Tab Order
Anyone else having problems setting the tab order or form fields in Adobe Designer? I go through and set them, and then when I go back, they reset. The "help" isn't much... Any ideas? Joe (that should be "tab order for form fields") ...

JTables:tabbing
I've got a JTable and I want to replace the existing text in a cell when the cell is focused. What I have currently works if the cell is double-clicked but if I tab to it, it appends the first letter typed to the existing text and THEN replaces the text with subsequent key strokes. How do I make tabbing act the same way as double-click? Thanks in advance, Nancy CODE:: table = new JTable(table_model){ public Component prepareRenderer(TableCellRenderer renderer, int rowIndex, int vColIndex){ Component c = super.prepareRenderer(renderer, rowIndex, vColIndex); if (isCellSelected(rowIn...

scripted import step
OK, I have another (probably dumb) question. I've continually run into difficulties with scripted Import Record commands. Here's what happens: I open the "Specify Import Order" window. I set up a custom mapping of fields, importing from one table into another. Everything works perfectly. Then I change the database structure, delete a field, add a field (nothing to do with the fields to be imported). And now the import script no longer correlates the fields correctly. Argh. It seems the import order is strictly hierarchical, like "Field 1 on the left goes to Fiel...

Tab Order
Is there a way to dictate tab order within a form? I am going to have 3 columns of text input fields, but I want to make it so that tabbing only brings the focus down the 3rd column. I know I can use onBlur(), but I want to try and avoid that. Anyone got other solutions? "Terry Olson" wrote > Is there a way to dictate tab order within a form? I am going to have 3 > columns of text input fields, but I want to make it so that tabbing only > brings the focus down the 3rd column. I know I can use onBlur(), but I want > to try and avoid that. Anyone got other solutions? No...

tab order
hello all, i'm working on a GUI and cannot find out how to stablish the tab order FOR PANELS. within a panel, i know that the order is established using the tab order editor, but it seems that it does not allow to change the order in which the user goes from one panel to the next with the tab key. any hints? thanks. and happy 2009 :) "pepita " <brendowel@hotmail.com> wrote in message <gk7n1q$mru$1@fred.mathworks.com>... > hello all, > > i'm working on a GUI and cannot find out how to stablish the tab order FOR PANELS. within a panel, i know that the ...

Tab Order
Any way to remove the Dotted-Line in the button or field thats the first in the Tab Order? Thanks DS DS wrote: > Any way to remove the Dotted-Line in the button or field thats the first > in the Tab Order? > Thanks > DS I doubt that it is possible, and I think you shouldn't do this because it is the vicual cue to the user where the focus is. -- Bas Cost Budde, Holland http://www.heuveltop.nl/BasCB/msac_index.html I prefer human mail above automated so in my address replace the queue with a tea ...

tab order
Hi all i am writing a program to validate shipping container numbers. Basically it gets each letter and number, gives it a value, does a bit of math and spits out an answer (kinda like basic cd key validation). I currently have 7 text boxes (one for each character). Everything works but i dont know how to do the following: Have a single text box and have it be able to work out each character. OR Set it up so that when i press a key it will automatically move the the next text box. At the moment i have to tab to each box. I prefer to have seperate text boxes for this app but i would like to l...