org.apache.pivot.wtk.ComponentKeyListener Java Examples
The following examples show how to use
org.apache.pivot.wtk.ComponentKeyListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MosaicPaneRefImpl.java From Mosaic with Apache License 2.0 | 4 votes |
private ComponentKeyListener getKeyListener() { if(listener == null) { listener = new ComponentKeyListener.Adapter() { Component source = null; @Override public boolean keyTyped(Component component, char character) { releaseShift(); return false; } @Override public boolean keyPressed(Component paramComponent, int paramInt, KeyLocation paramKeyLocation) { System.out.println("keyPressed paramComp = " + paramComponent); System.out.println("keyPressed paramInt = " + paramInt); System.out.println("keyPressed paramKeyLocation " + paramKeyLocation); if(paramKeyLocation == KeyLocation.LEFT && paramInt == 16) { System.out.println("press shift"); pressShift(); }else if(paramKeyLocation == KeyLocation.STANDARD && paramInt == 9) { System.out.println("press tab"); MosaicPane pane = (MosaicPane)paramComponent; Label l = (Label)clientMap.get(pane.getSurface().getCursor()); source = l; pane.getSurface().requestMoveBegin(l); }else if(paramKeyLocation == KeyLocation.STANDARD && paramInt == 10) { MosaicPane pane = (MosaicPane)paramComponent; pane.getSurface().requestMoveCommit(source, null, null); }else if(paramKeyLocation == KeyLocation.STANDARD && paramInt == 27) { MosaicPane pane = (MosaicPane)paramComponent; pane.getSurface().requestMoveCancel(source); }else if(paramKeyLocation == KeyLocation.STANDARD && paramInt >= 37 && paramInt <= 40) { moveCursor((MosaicPane)paramComponent, source, paramInt); }else{ System.out.println("release shift"); releaseShift(); } return false; } @Override public boolean keyReleased(Component paramComponent, int paramInt, KeyLocation paramKeyLocation) { if(paramKeyLocation == KeyLocation.LEFT && paramInt == 16) { System.out.println("release shift"); releaseShift(); }else if(paramKeyLocation == KeyLocation.STANDARD && paramInt == 9) { System.out.println("release tab"); }else{ System.out.println("release shift"); releaseShift(); } return false; } }; } return listener; }