Package java.awt

Examples of java.awt.Component.requestFocus()


            } catch (InterruptedException ex) {
            }
            root.setSize(new Dimension(rootSize.width, rootSize.height));
            // Request focus again even if dialog isn't supposed to have lost focus !
            if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow() != root) {
              root.requestFocus();
            }
          }
        });
    }
  }
View Full Code Here


                        // In one case, a call to requestFocus() alone does not
                        // bring the AWT dialog to the top. This happens if the
                        // dialog is given a null parent frame. When opened, the dialog
                        // can be hidden by the SWT window even when it obtains focus.
                        // Calling toFront() solves the problem.
                        focusOwner.requestFocus();
                        awtDialog.toFront();
                    } catch (NullPointerException e) {
                        // Some dialogs (e.g. Windows page setup and print dialogs on JDK 1.5+) throw an NPE on
                        // requestFocus(). There's no way to check ahead of time, so just swallow the NPE here.
                    }
View Full Code Here

                    // Restore focus to any AWT component that lost focus due to
                    // clearFocusOwner().
                    if (verboseFocusEvents) {
                        trace("restoring focus: " + savedOwner);
                    }
                    savedOwner.requestFocus();
                }
            });
        }
    }
   
View Full Code Here

                }
                if (verboseFocusEvents) {
                    trace("Setting AWT focus on SWT traversal, forward=" + forward + ", component=" + component);
                }
                if (component != null) {
                    component.requestFocus();               
                }
            }
        });
    }
View Full Code Here

                    Component component = frame.getMostRecentFocusOwner();
                    if (component != null) {
                        if (verboseFocusEvents) {
                            trace("Manually activating: " + frame + ", focus component=" + component);
                        }
                        component.requestFocus();
                    } else {
                        // Nothing can take focus, no point activating the frame.
                        if (verboseFocusEvents) {
                            trace("Ignoring manual activation; no focusable components in " + frame);
                        }
View Full Code Here

  }

  public void enterText(String componentName, String text) throws ComponentFinderException, TimeoutException {
    Component component = findComponent(componentName);
    component.requestFocus();
    typer.typeIntoComponent(component, text);
  }
   

  public void typeIntoTextComponent(TextComponent component, String text) {
View Full Code Here

            defaultComponent = cycleRoot.getFocusTraversalPolicy().getDefaultComponent(this);
        }
        if (defaultComponent == null) {
            return false;
        }
        defaultComponent.requestFocus();
        return true;
    }

    public boolean isManagingFocus() {
        return false;
View Full Code Here

     * Restores focus to the last subcomponent that had focus.
     */
    public void restoreSubcomponentFocus() {
        Component comp = getMostRecentFocusOwner();
        if (comp != null) {
            comp.requestFocus();
        } else {
            getContentPane().requestFocus();
        }
    }

View Full Code Here

                        if (modifier == KeyboardModifier.shift)
                            nextComponent = policy.getComponentBefore(ancestor, focusOwner);
                        else
                            nextComponent = policy.getComponentAfter(ancestor, focusOwner);
                        if (nextComponent != focusOwner)
                            nextComponent.requestFocus();
                        else
                            kk.doAction(textField, VKeyboard.this, e.getID());
                        return;
                    }
                } catch (Exception e1)
View Full Code Here

            this.nodeCommentShowedByEditor = selectedNode;
            this.noteEditor.addDirtyListener(this);
           
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    noteEditorComponent.requestFocus();
                }});
        }
    }

    private void showEmptyEditor() {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.