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

1 Replies
1421 Views

Similar Articles

[PageSpeed] 49


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

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

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

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

[JTable]JTable in Jtable
I am trying to set a JTable with some JTables in the second column. I have gone quite far but I am now facing a bug when adding a line with a selection active in the the column where I have JTables embedded. Column 0 is standard. How I proceed for cells of column 1: - in cells I put a JPane containing the header and the Table as it is the only possibility to display the header when not using a JScrollPane (my choice). - I customize Cell and Renderer to properly display my Header and Table that I extract from the embedded JPanels objects as built in colomn 1. - I do a few trick...

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

Customize a JTable
Hi everybody, Do you know if there is a free component like JTable that one can customize it? Sincerely, Alvaro Alvaro wrote: ... > Do you know if there is a free component like JTable that one can > customize it? Well, lemme' see. JTable does not cost anything, _and_ it can be extended or sub-classed - so it can be customized, ...therefore I suggest _JTable_. -- Andrew Thompson * http://www.PhySci.org/ Open-source software suite * http://www.PhySci.org/codes/ Web & IT Help * http://www.1point1C.org/ Science & Technology ...

Tab Tab
How can I direct the output from pressing tab tab to a file? Op 4 Aug 2004 12:39:13 -0700 schreef gnosis: > How can I direct the output from pressing tab tab to a file? gawk 'BEGIN {print "\t\t"}'</dev/null >file -- There's no place like 127.0.0.1 Gerard Wassink http://linux.family.filternet.nl http://freeware.family.filternet.nl Linux counter #360967, "In a world without fences, who needs gates?" gnosis wrote: > How can I direct the output from pressing tab tab to a file? I'm not sure I understand the ...

tab order
Hi, Can someone tell me how to setup the tab orders for the "web companion" ? The tab order on the web companion differs from the tab order in FMpro6 is this a bug ? thanks alain I'm not sure, but I would guess that there is no control. It would be determined by the browser. Left to right, top to bottom? Matt Revenaugh ------------ On 7/16/03 10:19 AM, in article Xns93BA8784F1620alaintmusicmcgillca@206.167.113.5, "Alain Terriault" <alaint@music.mcgill.ca> wrote: > Hi, > > Can someone tell me how to setup the tab orders for the "web companion...