Regarding Tab key Navigation in a page
Hi,
I have a requirement regarding the tab key navigation on a page.
Suppose the focus is on the last field of a page, on clicking the tab key i should go to the first field in the page not the url. i tried using tab index, but the problem is that after coming back to the first field from the last field, on clicking on tab again it does not go on as usual, it suddenly jumps to the url from there.
Regards
Krishna
OK Here is what I have ...
public class MultipleEditorsPerColumnJTable extends JTable {
/** Creates a new instance of MultipleEditorsPerColumnJTable */
public MultipleEditorsPerColumnJTable( int the_column) {
this.myColumn = the_column;
this.rowEditors = new ArrayList();
setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, Collections.EMPTY_SET);
setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, Collections.EMPTY_SET);
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e,int condition, boolean pressed) {
boolean isSelected = false;
if (ks == KeyStroke.getKeyStroke(KeyEvent.VK_TAB,0)) {
int selRow = getSelectedRow();
int rowCount = getRowCount();
int selCol = getSelectedColumn();
if (selCol == 1) { isSelected= getCellEditor(selRow,selCol).stopCellEditing();}
int targetRow = (selRow + 1) % rowCount;
this.editCellAt(targetRow, 1);
this.getComponentAt(targetRow, 1).requestFocus();
return super.processKeyBinding(ks,e,condition,pressed);
I think I know why the requestFocus() is not working. OK, I have a MultipleEditorsPerColumnJTable (sub of JTale), JTextPane, JButton and JLabel. The textpane, label and button have individual editors and renderers. Each time I want to display a new Row, I re-render these components and add it to the table.
Now with the above code, it still navigates to the next component in the row/ first column in next row depending on the current column. What am I doing wrong?
Thanks,
Praveen.
Similar Messages
-
Hello All,
Can anyone please help me with Tab key navigation in a JTable.I
read all the messages in this group but couldn't implement one.It
would be a great help if anyone can provide me a working example of how
to control the tab key in the JTable. I have a JTable with some of the
columns not editable, I want the focus to be in the first cell and
whenever the TAB key is pressed, the focus should go to next editable
cell and select the data in it.For example: if you take a simple table of 4 columns with column 2 not editable, The focus should begin with the first cell(1st column,1st row) and goto (3rd column,1st row) whenever TAB is pressed.It should work in reverse when SHIFT-TAB is pressed.
I'm new to Java Swing.I would greatly appreciate if anyone can provide me a working example.
Thanks in advance,
siddu.OK Here is what I have ...
public class MultipleEditorsPerColumnJTable extends JTable {
/** Creates a new instance of MultipleEditorsPerColumnJTable */
public MultipleEditorsPerColumnJTable( int the_column) {
this.myColumn = the_column;
this.rowEditors = new ArrayList();
setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, Collections.EMPTY_SET);
setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, Collections.EMPTY_SET);
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e,int condition, boolean pressed) {
boolean isSelected = false;
if (ks == KeyStroke.getKeyStroke(KeyEvent.VK_TAB,0)) {
int selRow = getSelectedRow();
int rowCount = getRowCount();
int selCol = getSelectedColumn();
if (selCol == 1) { isSelected= getCellEditor(selRow,selCol).stopCellEditing();}
int targetRow = (selRow + 1) % rowCount;
this.editCellAt(targetRow, 1);
this.getComponentAt(targetRow, 1).requestFocus();
return super.processKeyBinding(ks,e,condition,pressed);
I think I know why the requestFocus() is not working. OK, I have a MultipleEditorsPerColumnJTable (sub of JTale), JTextPane, JButton and JLabel. The textpane, label and button have individual editors and renderers. Each time I want to display a new Row, I re-render these components and add it to the table.
Now with the above code, it still navigates to the next component in the row/ first column in next row depending on the current column. What am I doing wrong?
Thanks,
Praveen. -
IECanvas browser + Tab key navigation
When I embed IE into IECanvas bowser, does it support TAB key navigation?
If not, How to achieve the same?See
http://www.yourhtmlsource.com/forms/formsaccessibility.html
Assign the tabindex attribute on the elements you want according to your desired navigation sequence. -
Problem with tab-key navigation
I am making chanegs to an existing form.
I have a tab canvas with 3 tabs, each contains a data block, and other data blocks outside of the tab canvas.
I wanted the tab key to move the cursor to the next record so I changed the navigation style from "Change Block" to "Change Record", but it did not help. When the cursor is a on a record of a multi-record block and I tab through the items to the last one, pressing the tab key leads me to another tab-page.
I put in some debug code and noticed that the WHEN-TAB-CHANGED trigger did not fire. The WHEN-VALIDATE-RECORD trigger fired and the cursor block and record number were correct.
After the tab key took me to another tab-page and I navigated back to the original tab-page. Even though it looks like I'm on the correct tab page, SYSTEM.cursor_block was NOT correct, it was pointing to another data block outside of the tab canvas.
I checked other forms on our system and I'm pretty sure that changing the navigation style to "Change Record" would work. Perhaps there's something peculiar about this form.
Any idea will be appreciated.
Thanks.Found the problem.
For some reason, the WHEN-NEXT-ITEM trigger of the last item of the record is hard-coded to go the another block. -
Tab Style Navigation Bar for Pages in Page group
Hi
Is there a way to create a tab style navigation bar for a group of pages that will appear at the top of a page?
Regards
HarryYou might try using Language_Switcher Language Switcher while working on the English page. That might allow you to create the navbar in English.
Otherwise you could use a text based navbar like in this demo page: Text Based Navbar
OT -
PJC tab-key navigation problem within bean (FORMS intercepting tab key??)
Using Forms 10.1.2.3, IE7, JRE 1.6
When attempting to navigate within the bean area, it appears as if FORMS is suppressing the keyEvent when the tab key is pressed. This means that I cannot use tab or shift-tab to navigate within the PJC's editable fields/buttons. I can click on them, enter data within them, but tab is somehow intercepted. When I place my PJC within a normal (non-forms) Java window, everything works fine.
Documentation that I've read seems to indicate that tab should navigate perfectly fine within the bean area.
Any ideas?Hi,
This is how I did it. Sorry about the formatting, it was OK when I pasted the code fragment in.
My class contains this in the variable definitions.
private AWTEventListener keyListener = new DoKey ();
private class DoKey implements AWTEventListener {
public void eventDispatched (AWTEvent e) {
//System.err.println("eventDispatched " + e.toString());
//System.err.println("eventDispatched source " + e.getSource().toString());
if ((e instanceof KeyEvent) && (e.getSource() instanceof Component)) {
* The event was a key pressed event and it was sourced from a Component.
KeyEvent evt = (KeyEvent) e;
if (evt.getID() == evt.KEY_PRESSED) {
if (evt.getKeyCode() == evt.VK_TAB) {
if (evt.isShiftDown()) {
((Component)e.getSource()).transferFocusBackward();
else {
((Component)e.getSource()).transferFocus();
The listener is enabled when on initialisation
Toolkit.getDefaultToolkit().addAWTEventListener (keyListener, AWTEvent.KEY_EVENT_MASK);
Regards, Tony C -
Prevent execution of Tab key at end of page
I have a multiple page form, at the end of each page there is "Continue" Button to navigate to the next page, it functions correctly for "Enter" or "Click", but if the tab key is pressed then sometimes the cursor goes to the browser URL area creating problems. Is there any way to prevent the execution of the Tab Key at the end of a page, or a javascript to add to the Event in the Continue button to prevent Tabbing?
ThanksHello Niall,
Thank you very much for this information. Our application runs in a browser I will give it a try.
I guess the problem is preventing the cursor from going to the URL, There is a risk of loosing all data if customer presses enter inadvertently when the cursor is in the URL (re-launching the application).
DFV -
JTable tab key navigation with JComboBox Cell Editors in Java 1.3 & 1.4
Hello - this is one for the experts!
I have a JTable which has an editable JComboBox as one of the cell editors for a particular column. Users must be able to navigate through the table using the tab key. After editing a cell a single tab should advance the cell selection to the next column and then the user should just be able to start typing to populate the cell.
However, i've come across some really frustrating differences between the Swing implementation of JDK1.3.1_09 and JDK 1.4.2_04 which means this behaviour is very different between versions!....
1. Editing Cells and then advancing to the next column using tab.
Using standard cell editors (based around JTextFields) in 1.3.1 the user has to press tab twice to traverse to the next column after editing. However, in 1.4.2 a single tab key is enough to move to the next column after editing.
2. Editable JComboBox editors and and advancing to the next column using tab.
Using JDK 1.3.1, having entered some text in the editable combo it takes 2 tabs to transfer the selected cell to the next column. With 1.4.2 a single tab while editing the editable combo ends editing and transfers the selection out of the table completely?!?
With these 2 issues I don't know how to make a single tab key reliably transfer to the next cell, between java versions. Can anyone please help me?!??!
(i've attached test code below which can be run in both 1.3 and 1.4 and demonstrates the above behaviour.)
package com.test;
import java.awt.*;
import javax.swing.table.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class TableTest4 extends JFrame {
private JTable table;
private DefaultTableModel tableModel;
public TableTest4() {
initFrame();
* Initialises the test frame.
public void initFrame() {
// initialise table
table = new JTable(10, 5);
tableModel = (DefaultTableModel) table.getModel();
table.setPreferredScrollableViewportSize(table.getPreferredSize());
table.setRowHeight(22);
JScrollPane scrollPane = new JScrollPane(table);
getContentPane().add(scrollPane);
JButton dummyBtn1 = new JButton("Dummy Button 1");
JButton dummyBtn2 = new JButton("Dummy Button 2");
// initialise frame
JPanel btnPanel = new JPanel(new GridLayout(2, 1));
btnPanel.add(dummyBtn1);
btnPanel.add(dummyBtn2);
getContentPane().add(btnPanel, BorderLayout.SOUTH);
// set renderer of first table column to be an editable combobox
JComboBox editableCombo = new JComboBox();
editableCombo.setEditable(true);
TableColumn firstColumn = table.getColumnModel().getColumn(0);
firstColumn.setCellEditor(new DefaultCellEditor(editableCombo));
public static void main(String[] args) {
TableTest4 frame = new TableTest4();
frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);Run the above code in 1.3 and 1.4 and you can see that after editing a cell, the tab key behaviour works differently between versions.
I don't believe by adding a key listener to the cell editors will have the desired effect.
I've read other posts and from what i've read it looks like the processKeyBinding method of the JTable can be overridden to manually handle key events.
Has anyone done this to handle tab key presses so that the same java app running under 1.3 and 1.4 works in the same way ??? I would really appreciate some advice on this as its very frustrating ! -
TAB key Navigation distance.....
I want to control the space alloted in a JTextPane when pressing TAB key.
More precisly I need to define the tab length when I press the TAB key.
Any help is appriciated !
ThanksHere is a working example that sets each of the first 10 tabs to represent 4 characters (the default is 8). This is applied to the entire document. Hope this helps.
import java.awt.*;
import javax.swing.*;
import javax.swing.text.*;
public class TestTextPane extends JFrame
public TestTextPane()
JPanel panel = new JPanel();
setContentPane( panel );
JTextPane textPane = new JTextPane();
textPane.setFont( new Font("monospaced", Font.PLAIN, 12) );
textPane.setText( "abcdefghijklmnop\n\tone\n\t\ttwo" );
JScrollPane scrollPane = new JScrollPane( textPane );
scrollPane.setPreferredSize( new Dimension( 200, 200 ) );
panel.add( scrollPane );
setTabs( textPane, 4 );
public void setTabs( JTextPane textPane, int charactersPerTab)
FontMetrics fm = textPane.getFontMetrics( textPane.getFont() );
int charWidth = fm.charWidth( 'w' );
int tabWidth = charWidth * charactersPerTab;
TabStop[] tabs = new TabStop[10];
for (int j = 0; j < tabs.length; j++)
int tab = j + 1;
tabs[j] = new TabStop( tab * tabWidth );
TabSet tabSet = new TabSet(tabs);
SimpleAttributeSet attributes = new SimpleAttributeSet();
StyleConstants.setTabSet(attributes, tabSet);
textPane.getStyledDocument().setParagraphAttributes(0, textPane.getDocument().getLength(), attributes, true);
public static void main(String[] args)
TestTextPane frame = new TestTextPane();
frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
frame.pack();
frame.setVisible(true); -
AdvancedDatagrid Tab Key issue
Hello, I have an advancedDatagrid which contains many editable column (InpuText) and each column has an itemrender. I see that the normal TAB key navigation behaivor disapear, can any one told me what's the best way to keep the Tab (shift+Tab) navigation behaivor between editable cells ? Thank you
I am having a simular problem. The software I am training
requires the user to use tab between fields. I changed the shortcut
key on text entry boxes. Somewhere on this forum (I cannot find it
now) I found a workaround that had me change the HTML file
Between the writeDocument <object> </object>
tags, add the following '<param name="SeamlessTabbing"
value="false">'+
when I publish without quiz reporting this worked fine. (it
matches the html of the other lines in the writeDocument But when I
publish with quiz reporting in AICC the HTML codes between the
writeDocument is different.
'<param name=quality value=high> \n'+
I altered the code I show above to match the html written by
captivate with no results. Any thoughts? -
Moowing focus with the tab key (swing)
Hi. I have a JFrame with 4 text areas in. I want to be able to "hop" to the next text area by pressing the tab key. Most internet pages says this is default, but when I press tab, I get a tab space inside the text area I'm in.. Any ideas on how to do this? (i use Java 1.5)
HashSet focusForward = new HashSet();
HashSet focusBackward = new HashSet();
focusForward.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB,0));
focusBackward.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB,InputEvent.SHIFT_DOWN_MASK));
myTextArea.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,focusForward);
myTextArea.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,focusBackward); -
Full screen mode and the tab key: how to ignore invisible UI elements
Hi there,
When Mozilla is in windowed mode, the tab key moves between the page content, which is great. However, when it reaches the end of the page, it then goes to the tab bar, the address bar, the search bar, something I can't figure out, and only then back to the page content.
When Mozilla is in full screen mode, it does the same thing, even though none of the UI elements (such as the menu bar et al) are actually visible.
So my question is this: is there a way to disable tab from going to the UI elements when FF is in full screen mode? If not, is there a way to disable this entirely?You have to change the cursor focus.
What I usually do for PDF pages/tabs, is click in the URL/location bar, then F11.<br />
For Flash, if you click on the page outside of the video area/box, F11 should work. -
Hi,
I have a program that I would like to programatically set key navigation. This is easily done with LV7 but I can not see how to do it with LV8. Any ideas?I can't provide an example - you have to follow the method. This is what I do:
1. create a new vi
2. place a system button on the front panel
3. right click the button
4. select the entry properties
5. switch to the tab "Key Navigation"
Now there should be an existing binding "Toggle" with return as assigned key.
I do not want to have this binding if I place a new button. If I place a standard LV button, there is no binding.
Is this a bug, a setting or maybe something NI wanted to work like this?
Using LV8.0
Don't be afraid to rate a good answer... -
Tab key no longer moves between text fields on a web page
Since upgrading to Mac OS X 10.4.9, my Safari v. 2.0.4 (419.3) is suffering from a bizarre symptom: the tab key no longer moves the insertion point among the various single-line text-entry fields on a page, but rather inserts a tab character within the field! Shift-tab, which used to move the insertion point back one field, does nothing.
Interestingly, when in a block-text field -- such as the one I'm using to compose this message topic -- the tab key takes me to the next field as expected. It also works when the insertion point is in the URL field or Google search field in the browser interface itself. It's only when I'm typing into a web page itself that it doesn't behave properly.
Makes filling out long forms a real pain.
Surely this isn't happening to everyone, or someone else would have mentioned it ... but can anyone reproduce it? Got any suggestions for clearing it up? I'm not running any exotic Safari add-ons, just the usual complement of plug-ins, none of which seem relevant to this problem, which involves normal HTML web pages.
Thanks in advance for any help.
G4 QuickSilver 1.467GHz Mac OS X (10.4.9)There were no file changes to Safari in the 10.4.9 update. There were a number of file changes to the System Library, however, these types of changes usually affect applications across-the-board. MacFixit has a special report and related issues and work-arounds on their site. Not sure if you need to be a subscribed member to see the information, however, it might be worth a look.
FWIW, I haven't seen any mention about the problem you reported on their forum, or home page report.
I suggested your marking the thread "answered" as I thought you were complete with the thread given the disappearance of the problem. I'll be curious to see who else posts a similar problem. -
Tabs in navigation page (Tabs persistance problem)
Hello all,
I'm looking for a workaround of tab persistence (the problem in post URGENT! TAB + Folder navigation Problem )
; is it possible, somehow, to make a navigation page with tabs, and in those tabs some kind of auto-redirection to the actual pages ? Or any other way using tabs? I just want to avoid image-map style navigation. This tab persistance feature is sooo anoying...
Please helpHello
I gave it up using tabs for navigation issue. There are too many problems with that. Now I'm using URL-items within navigation pages and that works fine...
Cheers,
Chrigel
Maybe you are looking for
-
Problem in starting SAP liveCache server
Hi, I am getting the following error message when i tried to start SAP liveCache server with LC10. "Restart of liveCache LC3 on saplc3cache terminated; reason: User LC3RFC has lock" Message no. LVC072 Does anyone has idea! abt the error? why it comes
-
Help with starting up G3 that won't power up
Hello, I have a powerbook G3 500mhz firewire with the first OSX version that I'm trying to get started up. It was working fine a few months ago (the last time I used it). Not it won't start up at all, no sounds or anything, even when plugged in. I'm
-
Transferring large files from my mac to pc
Hi guys, i'm trying to transfer a large file from my mac to my pc. Its over 7GB and my mac doesnt have a DL dvd burner so that's out of the question. I've tried transferring it over the network however the eta is 2 days which is a little too long. I'
-
Number range maintenance.....
Hello, experts, When am maintaining number ranges in OM, the current number status specified in number range maintenance is different from the one allotted to the object...for example, Subgroup $$S
-
So I have read everything I can...followed instructions from the mobile me status updates...even went to the mac store yesterday and flashed my pro care card to get some tech advise...and still I cannot get the "cloud" to do over air syncing of my ca