当前位置: 首页>>代码示例>>Java>>正文


Java Utilities.getFocusedComponent方法代码示例

本文整理汇总了Java中org.netbeans.editor.Utilities.getFocusedComponent方法的典型用法代码示例。如果您正苦于以下问题:Java Utilities.getFocusedComponent方法的具体用法?Java Utilities.getFocusedComponent怎么用?Java Utilities.getFocusedComponent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.netbeans.editor.Utilities的用法示例。


在下文中一共展示了Utilities.getFocusedComponent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setMenu

import org.netbeans.editor.Utilities; //导入方法依赖的package包/类
/** Sets the state of JMenuItem*/
protected @Override void setMenu(){
    
    ActionMap am = getContextActionMap();
    Action action = null;
    if (am != null) {
        action = am.get(getActionName());
    }
    
    JMenuItem presenter = getMenuPresenter();
    Action presenterAction = presenter.getAction();
    if (presenterAction == null){
        presenter.setAction(this);
        presenter.setToolTipText(null); /* bugfix #62872 */ 
        menuInitialized = false;
    } 
    else {
        if (!this.equals(presenterAction)){
            presenter.setAction(this);
            presenter.setToolTipText(null); /* bugfix #62872 */
            menuInitialized = false;
        }
    }

    if (!menuInitialized){
        Mnemonics.setLocalizedText(presenter, getMenuItemText());
        menuInitialized = true;
    }

    presenter.setEnabled(action != null);
    JTextComponent comp = Utilities.getFocusedComponent();
    if (comp != null && comp instanceof JEditorPane){
        addAccelerators(this, presenter, comp);
    } else {
        presenter.setAccelerator(getDefaultAccelerator());
    }

}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:39,代码来源:CompletionActionsMainMenu.java

示例2: actionPerformed

import org.netbeans.editor.Utilities; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent e) {

      ActiveEditorDrop drop = (ActiveEditorDrop) item.lookup(ActiveEditorDrop.class);
      JTextComponent target = Utilities.getFocusedComponent();
      if (target == null) {
          String msg = NbBundle.getMessage(HtmlPaletteActions.class, "MSG_ErrorNoFocusedDocument"); //NOI18N
          DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
          return;
      }
      
      try {
          drop.handleTransfer(target);
      }
      finally {
          Utilities.requestFocus(target);
      }
      
      try {
          FileObject fo = DataLoadersBridge.getDefault().getFileObject(target);
          if(fo != null) {
              PaletteController pc = HtmlPaletteFactory.getPalette(fo.getMIMEType());
              pc.clearSelection();
          }
      }
      catch (IOException ignored) {
      }

  }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:HtmlPaletteActions.java

示例3: getComponent

import org.netbeans.editor.Utilities; //导入方法依赖的package包/类
private static JTextComponent getComponent(){
    return Utilities.getFocusedComponent();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:NbCodeFoldingAction.java

示例4: getComponent

import org.netbeans.editor.Utilities; //导入方法依赖的package包/类
/** Returns focused editor component */
private static JTextComponent getComponent(){
    return Utilities.getFocusedComponent();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:MainMenuAction.java


注:本文中的org.netbeans.editor.Utilities.getFocusedComponent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。