Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to capture left parentheisis event...

 
ashok kandaswamy
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.......
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic