How to make the TAB Key Event called
Hi ,
I want to make the tab key called twice when I hit on a button. It should jump to the next 2 cell.
Thanks.
DT
Here's a couple related threads
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=583877
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=712386
I'd also suggest exploring the Search Forums available on the left,
which is how I found those threads:
http://onesearch.sun.com/search/onesearch/index.jsp?qt=focus+traversal+tab+text&subCat=siteforumid%3Ajava57&site=dev&dftab=siteforumid%3Ajava57&chooseCat=javaall&col=developer-forums
Similar Messages
-
Capturing the TAB key event.
How can I capture the TAB key event?
I am trying to use it within a JTextField to do a normal text tab operation.
Thanks,
DI want to map the Tab key to a jTextField so that when the user is editing inside the jTextField they can press the TAB key to tab over a predefined number of characters.
Thanks,
D -
How to recognize the tab key in a JTextField
I have a drawing program with a main window and a tools palette, which is a JDialog. The tools palette has JToggleButtons and one JTextField. When you have the focus in the JTextField and you press tab repeatedly, it tabs through all the JToggleButtons and then back into the JTextField.
However I would like to recognize the pressing of the tab key and ask for the focus to go back to the main window.
I subclassed the JTextField, added a KeyAdapter, but it does not recognize the tab key. I also added the processKeyBinding method, but it doesn't recognize the tab key either.
How can I recognize the tab key?
Here is a self-contained test program that illustrates the problem:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class AnanyaCurves extends JFrame
Tools tools;
public AnanyaCurves(Dimension windowSize)
Basics.ananyaCurves = this;
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
setTitle("Ananya Curves");
tools = new Tools(this);
public static void main(String[] args)
int toolsWidth;
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
toolsWidth = 200;
Dimension windowSize = new Dimension(screenSize.width - toolsWidth, screenSize.height - 58);
AnanyaCurves ananyaCurves = new AnanyaCurves(windowSize);
ananyaCurves.pack();
ananyaCurves.setBounds(toolsWidth, 0, windowSize.width, windowSize.height);
ananyaCurves.setVisible(true);
ananyaCurves.requestFocus();
public void setVisible(boolean b)
tools.setVisible(b);
super.setVisible(b);
class Basics extends java.lang.Object
public static AnanyaCurves ananyaCurves;
public Basics()
class Tools extends JDialog
JToggleButton btnGrid;
JTextField textGrid;
JPanel panel;
public Tools(JFrame frame)
super(frame, "Tools", false);
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
btnGrid = makeBtn("Grid");
textGrid = makeTextField();
panel = makePanel();
pack();
public JToggleButton makeBtn(String name)
JToggleButton btn = new JToggleButton();
btn.setMaximumSize(new Dimension(108, 24));
btn.setPreferredSize(new Dimension(108, 24));
btn.setText(name);
btn.setFont(new Font("Verdana", Font.PLAIN, 11));
btn.setMargin(new Insets(5, 10, 5, 10));
btn.setOpaque(true);
return btn;
public ACJTextField makeTextField()
ACJTextField textField = new ACJTextField();
textField.setFont(new Font("Verdana", Font.PLAIN, 12));
textField.setMaximumSize(new Dimension(108, 20));
textField.setPreferredSize(new Dimension(108, 20));
textField.setText("0.25");
textField.setEnabled(true);
return textField;
public JPanel makePanel()
JPanel panel = new JPanel();
panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
panel.add(btnGrid);
panel.add(textGrid);
getContentPane().add(panel);
return panel;
class ACJTextField extends JTextField
KeyAdaption keyAdaption;
public ACJTextField()
super();
keyAdaption = new KeyAdaption();
this.addKeyListener(keyAdaption);
class KeyAdaption extends KeyAdapter
public void keyPressed(KeyEvent event)
int keyCode = event.getKeyCode();
if (keyCode == KeyEvent.VK_TAB)
Basics.ananyaCurves.requestFocus();
protected boolean processKeyBinding(KeyStroke keyStroke, KeyEvent keyEvent, int int2, boolean boolean3)
int keyCode = keyEvent.getKeyCode();
if (keyCode == KeyEvent.VK_TAB)
Basics.ananyaCurves.requestFocus();
return false;
return super.processKeyBinding(keyStroke, keyEvent, int2, boolean3);
}Thanks for looking at this.Wow, Michael, you work like magic! Thanks so much! I would be happy to give you a commercial key to my Ananya Curves program also once the second release is on my website. It's a program for drawing curves in an easier way without pulling on tangent lines, with all control points right on the curve. Just send me an email to [email protected] if you are interested!
-
PUZZLER: How to assign the TAB key to a key command
For the past 11 years I've had the TAB key assigned to "record toggle". But in L8 I can't seem to make this k/command assignment occur... Even when the learn function is activated in the k/commands window, whenever I hit the TAB key to assign it to the currently highlighted key command, it simply changes the focus of the cursor, moving it from the highlighted command to the search field.
Looking for a clue... anyone?do you remember losing the function keys when tiger came out?
Yeah, I remember losing F14 and F15. They still don't work. But I've since figured out that those keys are reserved for adjusting the brightness on various Apple laptops, and I think also some other models. However, it doesn't apply to someone like, er, um, me who has a desktop-model Mac and a 3rd-party monitor which doesn't have a brightness control that responds to... you guessed it, F14 and F15. So those keys are dead, 'cept for my modifier key variants.
I tried importing my L7 prefs and sure enough, my L7 TAB assignment worked just fine. But I quickly reverted to my saved L8 prefs cuz I didn't want to take a chance of corrupting something or other because of an "illegal" key command assignment.
So I guess it's time to find another key for "record toggle". TAB is going to be an 11 year-old habit that's gonna die hard, I can tell... -
How to disable the Tab key?
Hi,
Usually,the most end users select partners name or code by the Tab key or pickers, how can I disable Tab key? I want users to select a partner by user-defined values.
Best Regards!Hi,
We donu2019t have a provision for disable the tab key in B1.
If you are assigning user defined value in any field, magnifying class will be displaying.
You should give a KT to end user that donu2019t use tab key, instead of tab key please click on magnifying class in those filed.
Thanks and Regards,
Senthil Maruthappan.
Team Work Never Fails
Edited by: Senthil Maruthappan on Jul 4, 2009 11:16 AM -
[Bug?] How to use the Tab key in forms
Ahoy!
The latest release of Photoshop has "broken" the native behavior of the Tab key in html panels. I'm not sure if this is a bug or just a new API I need to incorporate.
Expected behavior:
1. Focus into text field in a form
2. Hit the Tab key
3. The next field is focused.
Actual behavior
1. Focus into text field in a form
2. Hit the Tab key
3. Photoshop hides the application UI (Photoshop hotkey tab behavior).
Anyone happen to know if there's something that can be done about this?Bug is very annoying for our users when they try to input their usernames and passwords to login (often) and also when they're filling out a large form with four fields in it.
Hope it is fixed soon or a work around provided.
Tom Wrenn
Frontend Engineer
CreativeWorx -
How to disable the F4 Key Event?
Hi Guys,
I have written my own FocusManager which allows me to traverse through disabled components. If a user presses the F4 key while the focus is in a disabled JComboBox, the popup becomes activated. Is there any way deactivate the F4 keystroke?
I have tried:
event.consume();
combobox.setPopupVisible(false);
combobox.hidePopup();
I also read that F4 is a low-level event maintained by Windows. Is this true? Is there no alternative?
-Sri :)To anyone who may be interested:
I have tried all available solutions:
1. hidePopup()
2. setPopupVisible(false)
3. unregistering the F4 key event
4. catching the F4 key event and snubbing it
I have had no luck with the above solutions. It leads me to believe that F4 key is registered under the windows environment and it is a low-level event.
-Sri :) -
How to handle Shift+Tab key event
HI,
This is Ramesh.I have added KeyListener to JTable. I am handling key events through key codes. But I am
unable to handling multiple key strokes like Shift+Tab
Can any one please give me suggestion how can I do it
Thanks & Regards
Ramesh Ki dont know about Key BindingsWhich is why you where given a link to the tutorial in the first response.
can you please give me suggestion.You've been given the suggestion 3 times. You can decide to learn to write code the way other Swing components are written. Or, you can do it the old way. The choice is up to you. -
How to make the "place"key active??
If I want to open an image from a map, the "place" key appears not te be active...how come???
"Map" is probably "folder" or "directory"?
But we need a bit more detail. You know you cannot use "open" to place an image? And that you can only place them (which is what other software calls "Import") inside a document, not "open as new document"? -
How to stop the "Tab Key" from acting as a "SEND" button in gmail
Since installing the Firefox update today, when I hit the keyboard Tab Key in the course of composing an email on gmail, it sends the (!unfinished!) message. I need to disable this "feature". How?
In the compose window if you hit tab you are tabbing through the buttons on the compose window. You have to hit space in order to sent the message. Please check to see if there is a feature in your gmail that is added to the default. Or see if there is an add on that has saved this feature. You can try safe mode to eliminate the add on theory [[Troubleshoot Firefox issues using Safe Mode]] and reset Firefox if it is a saved application preference.
-
How to control the tab key navigate on the parameter ?
Hi all,
I have list of 20 parameter value which needs to be filled by the user when the report is being called. I have put the layout in the horizontal width where field1 - field 5 was in a column, field6 - field 10 another column, field11 - filed 15 again another column. So, when user is trying to enter parameter value, it suppose to go thru column by column but now after enter 1st value in the parameter form. The cursor is jump to second column, and I was unable to way how the navigate of column in report. Is there any way to control it such as in the oracle form ?
Please help me. Thanks.
LimI don't think so.
-
How to make the Enter key close a JDialog?
I have a dialog box which extends JDialog. I have several buttons and other components, but I would like to make the OK button the one which reacts when the user presses Enter. Are there any specific methods to get this behaviour?
dialog.getRootPane().setDefaultButton(okButton);
-
How to make the tabs something else
My homepage is Google. exactly what i want it to be but when i go to a tab / open a tab its trovi. How do i change that so its Google or just blank to where it shows other sites I've been on?
Hi, I'm afraid Trovi is a browser hijacker, so work through [http://malwaretips.com/blogs/trovi-removal/ this article] and hopefully you can remove it. You may then need to type '''about:config''' into the address bar, accept the warning, scroll down to '''browser.newtab.url''' and set 'Value' to '''about:newtab''' - right click to do this.
Hope that will solve your problem. -
How to make the enter key act as a button?
I have a CREATE and UPDATE button and I would like the user just to be able to press enter and perform the create or update as appropriate as if the button was pressed.
Thanks in advance for your help.
GregGreg,
Use the following so you don't loose the delete message:
<script type="text/javascript">
//<![CDATA[
htmldb_delete_message='"DELETE_CONFIRM_MSG"';
document.onkeypress = keyHandler;
function keyHandler(e) {
var keycode;
var id = $v('PXX_ID');
if(window.event){keycode = window.event.keyCode;
}else if(e){keycode = e.which;
}else{return true;}
if (keycode == 13){
if (id) {
doSubmit('UPDATE');
} else {
doSubmit('INSERT');
return false;
}else{
return true;
//]]>
</script>What is the name of your primary key item?
Are you getting any JavaScript errors?
Did anything happen?
Regards,
Dan
http://danielmcghan.us
http://sourceforge.net/projects/tapigen
http://sourceforge.net/projects/plrecur -
In ALV display model ,how to accept the ENTER key event?
Dear All,
I have used ALV by GRID DISPLAY model ,not class model.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
i_structure_name = 'T_ITAB'
is_layout = gs_layout
it_fieldcat = t_fieldcat[]
i_default = 'X'
i_save = 'A'
TABLES
t_outtab = t_itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
For example :
IN ALV DISPLAY, there are two fields, one is MATNR, the other is MAKTX.
When user input the material value in MATNR field and press ENTER, then ALV can run my code to select the MAKTX into MAKTX field and display it synchronization.
Now I have realized update edit in ALV,but I found only I double click ALV row, then the MAKTX can update.
Please give me help,
Thanks
SunThis is the document written by me on Interactive ALV.. hope this maybe helpful for u..
When an Interactive Report is needed in Classical Display, we go for AT LINE-SELECTION. But when the same is needed in ALV Display, this method won't work. Instead, we need to use other way which is explained below:
We use REUSE_ALV_GRID_DISPLAY for ALV Display. Now, normally we call that FM in the following way:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'PROGRAM_NAME'
it_fieldcat = tb_fieldcat
TABLES
t_outtab = tb_output.
When it is needed to get an Interactive ALV, call the same FM in the following manner:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZTEST75599_1'
it_fieldcat = tb_fieldcat
i_callback_user_command = 'USER_COMMAND'
TABLES
t_outtab = tb_output.
Now, in the report, create a subroutine with the name USER_COMMAND as follows:
FORM user_command USING p_ucomm LIKE sy-ucomm
p_selfield TYPE slis_selfield.
CASE p_ucomm.
WHEN '&IC1'. " &IC1 - SAP standard code for double-clicking
Based on the requirement, write the logic *
ENDCASE.
ENDFORM.
No need to call the subroutine as PERFORM user_command. This will be takane care by REUSE_ALV_GRID_DISPLAY. We need to just write the subroutine in the report. That suffices.
Some more useful points for Interactive ALV:
1. If Hotspot is needed, then that should be done by declaring hotspot (one field in slis_t_fieldcat_alv) as 'X' in tb_fieldcat which is of type slis_t_fieldcat_alv. When hotspot is active, single click will be enough or else you should double click on the output data.
2. In Classical Display, when it is needed to read the record on which we double clicked, we do that in following way:
AT LINE-SELECTION.
GET CURSOR LINE wf_line. " wf_line gives the line number on which it has been clicked
READ LINE wf_line OF CURRENT PAGE.
But this won't work for ALV. Instead, the following logic can be used:
FORM user_command USING p_ucomm LIKE sy-ucomm
p_selfield TYPE slis_selfield.
CASE p_ucomm.
WHEN '&IC1'. " &IC1 - SAP standard code for double-clicking
READ TABLE tb_output INTO wa_output INDEX p_selfield-tabindex.
IF sy-subrc EQ 0.
Based on the requirement, write the logic *
ENDIF.
ENDCASE.
ENDFORM.
Maybe you are looking for
-
Attendees not showing up in ical when clicking on a date in an email
Hey When I receive an email with a date and time in it and I click on that date and add it in to ical (using "Create New iCal Event" option), it allows me to give a name of the meeting, change time, set the alarm etc but I cant seem to add the attend
-
I am currently on yosemite on my mac mini. I have an Ipad with ios 8 in it. My itunes is updated to 12.0.1. When i sync my ipad, it gets synced but when i try to update apps through itunes it gives me an error : An unknown error occurred 8010. Tried
-
How do I get my music off of my Ipod onto my Iphone?
I need help
-
Unkown error (-50) ipod classic
i have recently been having a lot of issues with my ipod. ever since i updated my itunes to the most recent.songs not syncing onto it and when they do they are named wrong and have the wrong album artwork. or even better some of them just dont play.
-
I used HP Deskjet F4580 and it scanned fine, the image looked fine. When I saved the image (pdf, jpeg, png) they all come out as a gray color with banding. I tried another printer/scanner, HP Officejet 7310 and the exact same problem. I just purchas