aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes How to capture left parentheisis event... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to capture left parentheisis event..." Watch "How to capture left parentheisis event..." New topic
Author

How to capture left parentheisis event...

ashok kandaswamy
Greenhorn

Joined: Aug 19, 2008
Posts: 16
Hi All,

currently i am using JTextpane.In Key event now i am capturing shift_enter , control + W , by following code...actually i need key suppress here..

KeyStrokectrl_Wkeystroke=KeyStroke.getKeyStroke(KeyEvent.VK_W,ActionEvent.CTRL_MASK,false);//Falsesuppresses the tab keyrelease event..
textPane.getInputMap().put(ctrl_Wkeystroke, "ctrl_W_Pressed");
ControlWPressedAction ctrlWAction =new ControlWPressedAction(this,script,this.textPane);
textPane.getActionMap().put("ctrl_W_Pressed", ctrlWAction);


Like that i wants to capture "(" this key and i really want to suppress the actual key event i want to write my own code there...... For that i am using,

KeyStroke openbraceKeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT_PARENTHESIS, 0, false);//False suppresses the tab keyrelease event.. textPane.getInputMap().put(openbraceKeyStroke, "open_brace_pressed");
OpenBracedAction openBraceAction = new OpenBracedAction(this, script, this.textPane);
textPane.getActionMap().put("open_brace_pressed", openBraceAction);

The above code but it's not capturing..and then i am using

if (keyCode == KeyEvent.VK_LEFT_PARENTHESIS) {
System.out.println("I AM IN KEY RELEASED VK_LEFT_PARENTHESIS ");
}

In key Typed , key released...but still i am not able to get For " ( "....please tell me.i really need quick replay..

Thanks in advance......

-Ashok.......


Sk.Ashokkumar.....
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> Like that i wants to capture "(" this key and i really want to suppress the
> actual key event i want to write my own code there

DocumentFilter
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to capture left parentheisis event...