javax.swing.JComponent.isFocusable()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(103)

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

JComponent.isFocusable介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-dialogs

if (comp != null && comp.isFocusable()) {
  comp.requestFocus();

代码示例来源:origin: net.java.openjdk.cacio/cacio-shared

@Override
public boolean isFocusable() {
  boolean ret;
  if (swingComponent != null) {
    ret = swingComponent.isFocusable();
  } else {
    ret = false;
  }
  return ret;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Overridden to return false in cases that the preferences specify a 
 * read-only state */
public boolean isFocusable() {
  return super.isFocusable() && isEnabled() && (preferences & PREF_READ_ONLY) == 0;
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

/** Overridden to return false in cases that the preferences specify a
 * read-only state */
public boolean isFocusable() {
  return super.isFocusable() && isEnabled() && ((preferences & PREF_READ_ONLY) == 0);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Overridden to return false in cases that the preferences specify a 
 * read-only state */
public boolean isFocusable() {
  return super.isFocusable() && isEnabled() && (preferences & PREF_READ_ONLY) == 0;
}

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

public final void requestFocus(final JComponent component)
{
  Runnable r = new Runnable() {
    @Override
    public void run() {
      while (!component.isFocusOwner()) {
        component.requestFocusInWindow();
        try {
          Thread.sleep(1);
        } catch (InterruptedException ex) {
          Logger.getLogger(TestFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
      }
    }
  };
  if(component!=null&&component.isFocusable())
  {
    Executors.newCachedThreadPool().execute(r);
  }
}

代码示例来源:origin: JetBrains/jediterm

/**
 * @param component to check whether it can be focused or not
 * @return {@code true} if component is not {@code null} and can be focused
 * @see Component#isRequestFocusAccepted(boolean, boolean, sun.awt.CausedFocusEvent.Cause)
 */
public static boolean isFocusable(JComponent component) {
  return component != null && component.isFocusable() && component.isEnabled() && component.isShowing();
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

private boolean lazyValidate (WizardDescriptor.Panel panel) {
  if (panel instanceof ValidatingPanel) {
    ValidatingPanel v = (ValidatingPanel)panel;
    try {
      // try validation current panel
      v.validate();
    } catch (WizardValidationException wve) {
      // cannot continue, notify user
      if (wizardPanel != null) {
        wizardPanel.setErrorMessage (wve.getLocalizedMessage ());
      }
      // focus source of this problem
      if (wve.getSource () != null) {
        final JComponent comp = (JComponent) wve.getSource ();
        if (comp.isFocusable ()) {
          comp.requestFocus ();
        }
      }
      // lazy validation failed
      return false;
    }
  }
  return true;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

private boolean lazyValidate (WizardDescriptor.Panel panel) {
  if (panel instanceof ValidatingPanel) {
    ValidatingPanel v = (ValidatingPanel)panel;
    try {
      // try validation current panel
      v.validate();
    } catch (WizardValidationException wve) {
      // cannot continue, notify user
      if (wizardPanel != null) {
        wizardPanel.setErrorMessage (wve.getLocalizedMessage ());
      }
      // focus source of this problem
      if (wve.getSource () != null) {
        final JComponent comp = (JComponent) wve.getSource ();
        if (comp.isFocusable ()) {
          comp.requestFocus ();
        }
      }
      // lazy validation failed
      return false;
    }
  }
  return true;
}

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu

if(lbMessage_.isFocusable())
 lbMessage_.requestFocus();
else

相关文章

JComponent类方法