Package java.awt

Examples of java.awt.KeyboardFocusManager$LightweightFocusRequest


   
    // Configure furniture view
    JComponent furnitureView = (JComponent)controller.getFurnitureController().getView();
    if (furnitureView != null) {
      // Set default traversal keys of furniture view
      KeyboardFocusManager focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
      furnitureView.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
          focusManager.getDefaultFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS));
      furnitureView.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
          focusManager.getDefaultFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS));
 
      // Create furniture view popup menu
      JPopupMenu furnitureViewPopup = new JPopupMenu();
      addActionToPopupMenu(ActionType.UNDO, furnitureViewPopup);
      addActionToPopupMenu(ActionType.REDO, furnitureViewPopup);
View Full Code Here


     */
    private void postEvent(int id, long time, int modifiers, int keyCode,
                           char keyChar) {

        Component source = null;
        KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        if (kfm != null) {
            Component fo = kfm.getFocusOwner();
            if (fo == null) {
                Window win = kfm.getActiveWindow();
                if (win == null) {
                    win = kfm.getFocusedWindow();
                    if (win != null) {
                        source = win;
                    }
                } else {
                    source = win;
View Full Code Here

      return false;
    }

    if (editorRemover == null)
    {
      final KeyboardFocusManager fm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
      editorRemover = new CellEditorRemover(fm);
      fm.addPropertyChangeListener("permanentFocusOwner", editorRemover); // NON-NLS
    }

    this.editorComponent = editorComponent;

    final float zoomFactor = getRenderContext().getZoomModel().getZoomAsPercentage();
View Full Code Here

  /**
   * Creates a new focus-tracker and registers it on the permanent-focus-owner property.
   */
  protected FocusTracker()
  {
    final KeyboardFocusManager currentManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
    currentManager.addPropertyChangeListener(PERMANENT_FOCUS_OWNER, new FocusManagerChangeHandler());
  }
View Full Code Here

                    // if that frame is no longer active. In that case, we use a hack of
                    // disabling and re-enabling the window's focus owner. The hack has
                    // the drawback of a brief visual movement of the cursor (or other
                    // focus indicator), so it is good to avoid it whenever possible, as
                    // we do here.
                    KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
                    if (owner == kfm.getFocusOwner()) {
                        if (verboseFocusEvents) {
                            trace("clearing focus thru kfm: " + owner);
                        }
                        kfm.clearGlobalFocusOwner();
                    } else {
                        if (verboseFocusEvents) {
                            trace("clearing focus thru hack: " + owner);
                        }
                        owner.setEnabled(false);
View Full Code Here

    /**
     * Shows focus events on the top-level window on the AWT side.
     */
    private static class AWTWindowFocusListener implements WindowFocusListener {
        private void showKFMStatus(Window window) {
            KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
            System.err.println("               permanentFocusOwner: "+kfm.getPermanentFocusOwner());
            System.err.println("               focusOwner:          "+kfm.getFocusOwner());
            System.err.println("               window's focusOwner: "+window.getFocusOwner());
        }
View Full Code Here

     * @param root the root of a component hierarchy
     * @throws NullPointerException if the root is null
     */
    public CompoundFocusListener(JComponent root) {
        this.root = Contract.asNotNull(root, "root must not be null");
        KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        addManagerListener(manager);
        permanentFocusOwnerChanged(manager.getPermanentFocusOwner());
    }
View Full Code Here

        ticker.launch();
        feedback.launch();
    }

    private void setupKeystrokes() {
        KeyboardFocusManager mgr = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        mgr.addKeyEventDispatcher(new Dispatcher(feedback, controller));
    }
View Full Code Here

        KeyboardFocusManager.getCurrentKeyboardFocusManager().setDefaultFocusTraversalPolicy(new DefaultFocusTraversalPolicy());
        focusManagerEnabled = false;
    }

    public static FocusManager getCurrentManager() {
        KeyboardFocusManager currentManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        if (currentManager instanceof FocusManager) {
            return (FocusManager)currentManager;
        } else {
            return null;
        }
View Full Code Here

        }
      }
    });
   
    //KeyListener
    KeyboardFocusManager kbf = KeyboardFocusManager.
    getCurrentKeyboardFocusManager();
   
    final KeyEventDispatcher EventDispatcher = new KeyEventDispatcher() {

      @Override
      public boolean dispatchKeyEvent(KeyEvent e) {
        boolean keyUsed = false;
        if(e.getID() == KeyEvent.KEY_PRESSED){
          if(e.getKeyCode() == 525 && treeTable.getSelectedRowCount() == 1){
            popMenu = new JPopupMenu();
            int p = treeTable.getSelectedRow();
            buildPopupMenu(p);
            popMenu.show(treeTable, treeTable.getColumn(0).getWidth()/2, (int) (treeTable.getRowHeight()*(p+0.5)));
          }
        }
        return keyUsed;
     

    };
   
    kbf.addKeyEventDispatcher(EventDispatcher);
   
    //Window Listener
    mainFrame.addWindowListener(new WindowAdapter() {
     
      @Override
View Full Code Here

TOP

Related Classes of java.awt.KeyboardFocusManager$LightweightFocusRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.