How to trap the Escape & Enter key ?
I want to close the window when user presses escape key & want to trap the enter key for some action.
Help will be higly appreciated.
import javax.swing.*;
public class KeyItIn extends JFrame{
JTextArea jta[] = new JTextArea[2];
public KeyItIn() {
getContentPane().setLayout(new java.awt.GridLayout(2,1) );
for(int i=0; i<2; i++){
jta[i] = new JTextArea();
jta.setBorder(BorderFactory.createEtchedBorder());
jta[i].addKeyListener(new EventKeyHandler() );
getContentPane().add(jta[i]);
setDefaultCloseOperation( EXIT_ON_CLOSE );
pack();
class EventKeyHandler extends java.awt.event.KeyAdapter{
public void keyPressed(java.awt.event.KeyEvent e){
jta[0].setText(" Key Typed: "+(char)e.getKeyCode());
jta[1].setText(" Key code = "+e.getKeyCode() );
public static void main(String[] args) {
new KeyItIn().show();
Similar Messages
-
how do I enable the "fn + enter" key to work as an "insert" function for windows on my mac laptop?
enable /disable function within the Bootcamp control panel within Windows Vista or 7
-
Hi,
1. How to di-activate <CR> 'Enter Key' HTML Code?
2. How to increase the the font of DW Help Explanations?1. How to di-activate <CR> 'Enter Key' HTML Code?
Enter = paragraph <p>
Shift + Enter = line break <br>
To adjust browser default line spacing between paragraphs and headings, use CSS.
p {
text-indent: 4em;
margin-top: 0;
margin-bottom: 0;
line-height: 1.2em;
Does this help?
Nancy O.
Alt-Web Design & Publishing
Web | Graphics | Print | Media Specialists
www.alt-web.com/
www.twitter.com/altweb
HTML Validator - http://validator.w3.org
CSS Validator - http://jigsaw.w3.org/css-validator/
Tutorials - http://w3schools.com/ -
Question
How to disable the previously entered user ID's that automatically appear. For example ; when logging into email , first letter of user ID prompts the previously used email user IDs... Want to disable this feature---How can it be done ?*Click the (empty) input field on the web page to open the drop down list
*Highlight an entry in the drop down list
*Press the Delete key (on Mac: Shift+Delete) to remove it.
*http://kb.mozillazine.org/Deleting_autocomplete_entries
* Tools > Options > Security: Passwords: "Saved Passwords" > "Show Passwords"
* Tools > Options > Privacy > History: "Remember search and form history"
* https://support.mozilla.com/kb/Remembering+passwords
* https://support.mozilla.com/kb/Form+autocomplete -
How to capture the data entered in a textfield in a JTable
How to capture the data entered in a textfield present in a cell of a textfield or how to add listener to this textfield
A sample of my code is:
model = new GridDisplayTableModel(gridDisp,columnName,getRows(),getCols());
final ComboRenderer cRenderer = new ComboRenderer();
final TextFieldRenderer tRenderer = new TextFieldRenderer();
combo.addItem("one");
combo.addItem("two");
combo.addItem("three");
final JTextField textfield = new JTextField();
final DefaultCellEditor cmbEditor = new DefaultCellEditor(combo);
// final JEnterDataCellEditor textEditor = new JEnterDataCellEditor(12);
final DefaultCellEditor textEditor = new DefaultCellEditor(textfield);
rm = new RowEditorModel();
table = new JTable(model){
public TableCellRenderer getCellRenderer(int row, int column) {
int posx = 0;
int posy = 0;
TableCellRenderer renderer = null;
for(int l=0;l<getDataVec().size();l++)
beanObj =(Helperbean)dataVec.elementAt(l);
posx = beanObj.getPosx();
posy = beanObj.getPosy();
if(row==posx && column==posy)
if(beanObj.getModeofDisplay() != null && beanObj.getModeofDisplay().equalsIgnoreCase("textfield"))
rm.addEditorForRow(row,textEditor);
renderer = tRenderer;
else if(beanObj.getModeofDisplay() != null && beanObj.getModeofDisplay().equalsIgnoreCase("combo"))
rm.addEditorForRow(row,cmbEditor);
renderer = cRenderer;
break;
renderer = super.getCellRenderer(row, column);
// System.out.println("getEditor"+rm.getEditor(1));
return renderer;
public TableCellEditor getCellEditor(int row, int col) {
int posx = 0;
int posy = 0;
TableCellEditor tmpEditor = null;
for(int l=0;l<getDataVec().size();l++)
beanObj =(Helperbean)dataVec.elementAt(l);
posx = beanObj.getPosx();
posy = beanObj.getPosy();
if(row==posx && col==posy)
if(beanObj.getModeofDisplay() != null && beanObj.getModeofDisplay().equalsIgnoreCase("textfield"))
System.out.println("celleditorval "+textEditor.getCellEditorValue());
tmpEditor = textEditor;
else if(beanObj.getModeofDisplay() != null && beanObj.getModeofDisplay().equalsIgnoreCase("combo"))
tmpEditor = cmbEditor;
break;
tmpEditor = super.getCellEditor(row, col);
return tmpEditor;
public boolean isCellEditable(int row,int col){
boolean isEditable = false;
int posx = 0;
int posy = 0;
for(int l=0;l<getDataVec().size();l++)
beanObj =(Helperbean)dataVec.elementAt(l);
posx = beanObj.getPosx();
posy = beanObj.getPosy();
if(row==posx && col==posy)
if(beanObj.getModeofDisplay() != null )
isEditable = true;
else
isEditable = false;
break;
isEditable = false;
return isEditable;
public void changeSelection(final int row, final int column, boolean toggle, boolean extend) {
super.changeSelection(row, column, toggle, extend);
//my attempt to avoid editCellAt from being called twice in a row
if (getModel().isCellEditable(row, column) && !(isEditing() && getEditingRow() == row && getEditingColumn() == column))
if (editCellAt(row, column)) {
getEditorComponent().requestFocus();
// Select the text when the cell starts editing
public boolean editCellAt(int row, int column) {
boolean result = super.editCellAt(row, column);
final Component editor = getEditorComponent();
if (editor != null && editor instanceof JTextField) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
((JTextField)editor).selectAll();
return result;
public boolean hasFocus()
Component editorComponent = getEditorComponent();
// Try to install the editor
int anchorRow = getSelectionModel().getAnchorSelectionIndex();
int anchorColumn = getColumnModel().getSelectionModel().
getAnchorSelectionIndex();
if (anchorRow != -1 && anchorColumn != -1 && !isEditing())
if ((this.getSelectedRow() == anchorRow) && (this.getSelectedColumn() == anchorColumn))
if (!editCellAt(anchorRow, anchorColumn)) {}
return super.hasFocus();
public void valueChanged(ListSelectionEvent e)
super.valueChanged(e);
if ((this.getSelectedRow() == 2) && (this.getSelectedColumn() == 3))
DefaultFocusManager focusManager = new DefaultFocusManager();
focusManager.focusNextComponent(this);
model.fireTableStructureChanged();
-
Hi All,
How to use the manually entered Hours/Days in the Duration field for BG_ABSENCE_DURATION fast formula?
Requirement is to restrict employees for applying for leave more than the accrued balance. In SSHR, apply leave functionality, the employee enters the start date, end date and duration manually. The entered duration must be used in the fast formula to check against available balance.
In the BG_ABSENCE_DURATION FF, I have a function to calculate the net accrual balance as on the calculation date.
I want to add the logic as - If to_number(Duration) /*[manually entered value]*/ > net accrual balance then
Duration = 'FAILED'
invalid_msg = 'Error'
return duration, invalid_msg
Thanks!Hi,
We have a standard functionality to override the duration calculation and you don't need to add a validation for the same. Please set the value of profile option HR: Absence Duration Auto Overwrite to Yes
When you do this user will not have to enter the duration value manually. It will get auto calculated based on the duration calculation in BG_ABSENCE_DURATION when you click on the next button.
For not allowing negative leaves to be applied, If you are on R12 then, this is a standard functionality and you need to set profile option HR Allow Absence Negative Balance to No
If you are on 11i then refer Note: 268171.1: How Do You Stop Accrual Plans from Going Negative?
Try and let me know in case you need further help.
Thanks,
Sanjay -
How to keep the data entered on a page apex
how to keep the data entered on a page apex
so, I've got a registration page then wish go to another page P2 and I return to this P1 without losing dataHi,
As long as the registration page is within the same session, the values will remain in the session until they are specifically cleared out. This can be done by a process on a page - so check if you have a "reset page" process on P1 and, if you do, delete it. This can also be done on a branch - so check the branch that takes you to P2 and see if there is anything entered in the Clear Cache setting and, if it shows *1*, remove that. There are other ways as well, but these are most typical.
Andy -
How to get the user entered data?
Hi all,
I have created an HTMLB DynPage component.
In That i have created my input screen with textboxes using response.write method.
i have added one onConfirm event on which the data whould validate.
so onConfirm method im trying to get the data with request.getParameter method which returns null...
how to do...how to get the user entered data to do my validations...can anyone plz advice.
Thanks,
ViswesHi
inputfield or textbox component entered directly using response.write(...) are not htmlb , but html.
to create portal input field (ie HTMLB), you should do something like
this in the doProcessBeforeOutput member function
InputField field1 = new InputField("Id1");
field1.setSize(8); // 8 characters
this.getForm().addComponent(field1);
and in doProcessAfterInput member function
InputField field1 =
(InputField) this.getComponentByName("Id1");
you can then manipulate the content of the field.
Hope this help,
Guillaume -
How to judge the mouse enter which one of buttons?
There two buttons(no text,only icon on them),
and how to judge the mouse enter which one of
them and show the different message at one textfield?Try this. I don't know if the code works, but the true solution will be like it.
void mouseClicked(MouseEvent e)
int mask = e.getModifiers();
if((mask & InputEvent.BUTTON1_MASK) != 0)
System.out.println("You touched to the button 1!");
else if((mask & InputEvent.BUTTON2_MASK) != 0)
System.out.println("You touched to the button 2!");
else if((mask & InputEvent.BUTTON3_MASK) != 0)
System.out.println("You touched to the button 3.");
}Ghys -
How to trap the exception in cursors
Hi
How to trap the exception NO DATA FOUND/other exceptions with the cursor
DECLARE
CURSOR c1 IS SELECT * FROM EMP WHERE empno = 1234;
BEGIN
FOR i IN c1 LOOP
DBMS_OUTPUT.PUT_LINE(i.ename);
END LOOP;
END;so 1234 is not in my table, how to trap this.could some one help me please
Edited by: user4587979 on Sep 27, 2010 3:46 AMuser4587979 wrote:
Hi
How to trap the exception NO DATA FOUND/other exceptions with the cursor
DECLARE
CURSOR c1 IS SELECT * FROM EMP WHERE empno = 1234;
BEGIN
FOR i IN c1 LOOP
DBMS_OUTPUT.PUT_LINE(i.ename);
END LOOP;
END;so 1234 is not in my table, how to trap this.could some one help me please
Edited by: user4587979 on Sep 27, 2010 3:46 AMYou don't trap NO_DATA_FOUND in a cursor loop, as for others ... you trap and handle the ones you expect.
NO_DATA_FOUND isn't a condition associated with the processing of a cursor loop.
You have other options though, for example ...
declare
l_processed_something boolean default false;
begin
for x in cursor
loop
l_processed_something := true;
<more processing>
end loop;
end;
/ -
I have a new mac and want my old photoshop on it , how get i the old serial key for the new ? My old mac is deleted ...
We would need to know the version of Mac OS you are running and the version of Photoshop you want to install.
The serial number is the tricky part. If you have no idea where you placed it and did not register your product with Adobe, your chances are very low of retrieving it. -
How to set the short cut key for buttons
Hi
I dont know how to set the short cut keys for the button...can u pls help me outDo you mean a short cut key for buttons at client side (web browser)? If yes, you could do it with JavaScript~~~ ^o^
-
How to Provide the Certificate Generation key while configuring WorkFlow Manager 1.0
Hi,
I am new to Workflow manager.I am configuring it in a SharePoint Farm with Allow Workflow Management over Http on this computer option.
Its asking for Certificate Generation key for joining to the Farm.
Could anyone help me how to get the Certificate Generation key.
Please advice
Thanks, Vijay Arul Lourduwe forgot the auto-generated Certificate
Generation Key. Can you tell us the detail instructions to find it? Thanks. -
Hi All,
How to get the process instance key so as to retry a rejected task through API while AD provisioing state?
API URL - http://docs.oracle.com/cd/E27559_01/apirefs.1112/e28159/toc.htm
ThanksTo retry a task that is in a rejected state, you use the SCH_KEY which is the task key. In OIM, all rejected tasks are listed in the OTI table. It contains all the important information about a rejected or pending task.
You can use the APIs found in the tcProvisioningOperationsIntf class to retrieve open tasks.
-Kevin -
How was created the cluster with keys in example: Sim Phone.vi
Hello all
I have LV 7.1.1
I have found the example: Sim Phone.vi
And I don't know how was created the cluster with keys?
Best regards
IskanderIt's just like any other cluster you create. Put a cluster container on the front panel and insert some Booleans. the actual Booleans are on the classic controls palette. The border of the cluster is also colored transparent with the paintbrush on the Tools palette.
Maybe you are looking for
-
Sending output to a printer in a background job
I did a quick search on this issue and found a few suggestions. One suggestion was to use something like this: SUBMIT RSFLFIND ... TO SAP-SPOOL DESTINATION 'LT50'. I looked at the SAP help for SUBMIT and it was quite helpful however it raised a few
-
My consoleone is no longer working with groupwise
Hello Somehow I screwed up my consoleone. It is GroupWise 7.0.3 and running on SUSE Linux 10.1 . Now when I select domain, the domain databases come up but none of the GroupWise options are available and it is just showing the standard consoleone inf
-
Please help
-
Warm greetings Group Members what is the difference of Statistics-relevant delivery date and Delivery date in Purchase order Regards Shamulheq
-
Purchase requisition after MRP for Semifinished & raw material
Hello Gurus, Please guide me in following scenario : FERT - X ---> HALB (subcontracting) - Y ---> ROH - Z Requirement : X - 1000 , Y - 1000 & Z - 1000 In this case, when I will take the MRP for X ,then MRP will generate PR for Y & Z. But in my case,