javafx.scene.Scene.getFocusOwner()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(104)

本文整理了Java中javafx.scene.Scene.getFocusOwner()方法的一些代码示例,展示了Scene.getFocusOwner()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Scene.getFocusOwner()方法的具体详情如下:
包路径:javafx.scene.Scene
类名称:Scene
方法名:getFocusOwner

Scene.getFocusOwner介绍

暂无

代码示例

代码示例来源:origin: jfoenixadmin/JFoenix

Node node = getScene().getFocusOwner();
if (node instanceof DateCell) {
  currentFocusedDayCell = (DateCell) node;

代码示例来源:origin: stackoverflow.com

Scene scene = fields[0].getScene();
Node focusOwner = scene.getFocusOwner();
if (focusOwner instanceof TextField) {
   TextField focusedField = (TextField) focusOwner;
   ...
}

代码示例来源:origin: com.powsybl/powsybl-gse-util

public static <T> void registerAccelerator(Scene scene, KeyCodeCombination key, Class<T> aClass, Consumer<T> a) {
  scene.getAccelerators().put(key, () -> {
    Node node = scene.getFocusOwner();
    while (node != null) {
      if (aClass.isAssignableFrom(node.getClass())) {
        a.accept((T) node);
        break;
      }
      node = node.getParent();
    }
  });
}

代码示例来源:origin: org.controlsfx/controlsfx

private void validateButton( ButtonType buttonType, BooleanSupplier condition) {
  Button btn = (Button)dialog.getDialogPane().lookupButton(buttonType);
  if ( btn != null ) {
    Node focusOwner = (btn.getScene() != null) ? btn.getScene().getFocusOwner() : null;
    btn.setDisable(condition.getAsBoolean());
    if(focusOwner != null) {
      focusOwner.requestFocus();
    }
  }
}

代码示例来源:origin: stackoverflow.com

for (Node n = scene.getFocusOwner(); n!= null ; n=n.getParent()) {
  if (n == textArea) return true ;

代码示例来源:origin: org.tentackle/tentackle-fx

@Override
public void fire() {
 if (!isFocusTraversable() && !isCancelButton()) {
  /*
   * If the button is not focus traversable, it will not receive the focus when clicked.
   * As a consequence, an opposite FxComponent will not lose its focus which in turn
   * means, that the model is not updated. If the action handler of this button
   * depends on it, it will not see the last user's input.
   * In such cases we must perform the model update explicitly before firering the event.
   */
  Node node = getScene().getFocusOwner();
  if (node instanceof FxComponent) {
   FxUtilities.getInstance().focusLost((FxComponent) node);
  }
 }
 super.fire();
}

代码示例来源:origin: org.drombler.commons/drombler-commons-docking-fx

activeDockable.addListener((observable, oldValue, newValue) -> {
  if (newValue != null) {
    final Node currentFocusOwner = newValue.getDockable().getScene().getFocusOwner();
    if (currentFocusOwner == null || !isFocusInDockable(newValue.getDockable(), currentFocusOwner)) {
      LOG.debug("Request focus for new active Dockable: '{}'!", newValue.getDockableData().getTitle());

代码示例来源:origin: org.tentackle/tentackle-fx

Scene scene = getNode().getScene();
if (scene != null) {
 Node node = scene.getFocusOwner();
 if (node != getNode() &&
   (!(node instanceof FxComponent) || ((FxComponent) node).getError() == null)) {

代码示例来源:origin: com.jfoenix/jfoenix

Node node = getScene().getFocusOwner();
if (node instanceof DateCell) {
  currentFocusedDayCell = (DateCell) node;

相关文章