KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > javax > swing > text > Keymap

javax.swing.text
Interface Keymap

See Also:
Top Examples, Source Code

void addActionForKeyStroke(KeyStroke key,
                           Action a)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


Action getAction(KeyStroke key)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


Action[] getBoundActions()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


KeyStroke[] getBoundKeyStrokes()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


Action getDefaultAction()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


KeyStroke[] getKeyStrokesForAction(Action a)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


String getName()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


Keymap getResolveParent()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


boolean isLocallyDefined(KeyStroke key)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


void removeBindings()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


void removeKeyStrokeBinding(KeyStroke keys)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[49]Html editor
By Anonymous on 2004/10/11 13:04:05  Rate
/** 
  * JEditorPane using 
  * HTMLEditorKit to insert  < BR >  tag when pressing Enter,  
  * insted of  < P >  < /P >  tags, as it works now. 
  */
 
  
  
 public HTMLEditor (  )   {  
  
  
   Action breakAction=new AbstractAction (  )   {  
     public void actionPerformed ( ActionEvent ev )   {  
       insertBreak (  ) ; 
      }  
    } ; 
  
  
   Keymap map=getKeymap (  ) ; 
   KeyStroke key=KeyStroke.getKeyStroke ( KeyEvent.VK_ENTER, 0 ) ; 
   map.removeKeyStrokeBinding ( key ) ; 
   map.addActionForKeyStroke ( key, breakAction ) ; 
  }  
 . 
 . 
 . 
  
  
 public void insertBreak (  )   {  
  
  
   HTMLEditorKit kit= ( HTMLEditorKit ) getEditorKit (  ) ; 
   try  {  
     kit.insertHTML (  ( HTMLDocument ) getDocument (  ) ,getCaretPosition (  ) , " < br > ", 0, 0, HTML.Tag.BR ) ; 
    }  
   catch  ( Exception ex )   {  
     ex.printStackTrace (  ) ; 
    }  
  }  
 


void setDefaultAction(Action a)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


void setResolveParent(Keymap parent)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags