javax.swing.text.JTextComponent.requestFocus()方法的使用及代码示例

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

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

JTextComponent.requestFocus介绍

暂无

代码示例

代码示例来源:origin: wiztools/rest-client

@Override
public void requestFocus() {
  se_req_body.getEditorComponent().requestFocus();
}

代码示例来源:origin: skylot/jadx

private void process(MouseEvent e) {
    textComponent.requestFocus();

    boolean enabled = textComponent.isEnabled();
    boolean editable = textComponent.isEditable();
    boolean nonempty = !(textComponent.getText() == null || textComponent.getText().equals(""));
    boolean marked = textComponent.getSelectedText() != null;
    boolean pasteAvailable = Toolkit.getDefaultToolkit().getSystemClipboard()
        .getContents(null).isDataFlavorSupported(DataFlavor.stringFlavor);

    undoAction.setEnabled(enabled && editable && undoManager.canUndo());
    redoAction.setEnabled(enabled && editable && undoManager.canRedo());
    cutAction.setEnabled(enabled && editable && marked);
    copyAction.setEnabled(enabled && marked);
    pasteAction.setEnabled(enabled && editable && pasteAvailable);
    deleteAction.setEnabled(enabled && editable && marked);
    selectAllAction.setEnabled(enabled && nonempty);

    int nx = e.getX();
    if (nx > 500) {
      nx = nx - popup.getSize().width;
    }
    popup.show(e.getComponent(), nx, e.getY() - popup.getSize().height);
  }
}

代码示例来源:origin: deathmarine/Luyten

public void valueChanged(ListSelectionEvent e) {
    if (e.getValueIsAdjusting() == false) {
      JList<?> list = (JList<?>) e.getSource();
      String selectedValue = (String) list.getSelectedValue();
      String oldValue = textComponent.getText();
      textComponent.setText(selectedValue);
      if (!oldValue.equalsIgnoreCase(selectedValue)) {
        textComponent.selectAll();
        textComponent.requestFocus();
      }
      updateSampleFont();
    }
  }
}

代码示例来源:origin: RipMeApp/ripme

textComponent.requestFocus();

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

textComponent.requestFocus();

代码示例来源:origin: org.owasp.jbrofuzz/jbrofuzz

private void checkForTriggerEvent(final MouseEvent e) {
  if (e.isPopupTrigger()) {
    area.requestFocus();
    popmenu.show(e.getComponent(), e.getX(), e.getY());
  }
}

代码示例来源:origin: org.owasp.jbrofuzz/jbrofuzz

private void checkForTriggerEvent(final MouseEvent e) {
  if (e.isPopupTrigger()) {
    area.requestFocus();
    popmenu.show(e.getComponent(), e.getX(), e.getY());
  }
}

代码示例来源:origin: otros-systems/otroslogviewer

@Override
 public void keyTyped(KeyEvent e) {
  textComponent.dispatchEvent(e);
  textComponent.requestFocus();
 }
});

代码示例来源:origin: org.owasp.jbrofuzz/jbrofuzz

public void run() {
    final JTextComponent text = SelectAllAction.this
    .getTextComponent(evt);
    if (text != null) {
      text.selectAll();
      text.requestFocus();
    }
  }
});

代码示例来源:origin: freeplane/freeplane

@Override
public void show() {
  textComponent.requestFocus();
  super.show();
}

代码示例来源:origin: org.netbeans.api/org-netbeans-spi-quicksearch

@Override
public void requestFocus() {
  super.requestFocus();
  command.requestFocus();
}

代码示例来源:origin: org.owasp.jbrofuzz/jbrofuzz

public void run() {
    final JTextComponent text = CutAction.this
    .getTextComponent(evt);
    if (text != null) {
      text.cut();
      text.requestFocus();
    }
  }
});

代码示例来源:origin: omegat-org/omegat

private void setText(JTextComponent comp, String text) {
    comp.setText(text);
    comp.requestFocus();
    comp.selectAll();
  }
});

代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql

public void run()
  {
    _sqlEntry.getTextComponent().requestFocus();
  }
});

代码示例来源:origin: freeplane/freeplane

@Override
  public void actionPerformed(final ActionEvent e) {
    textComponent.requestFocus();
    ResourceController.getResourceController().setProperty("el__enter_confirms_by_default",
      Boolean.toString(enterConfirms.isSelected()));
  }
});

代码示例来源:origin: otros-systems/otroslogviewer

protected void suggestionSelected(T suggestion, SuggestionQuery query) {
 final SuggestionResult<T> result = new SuggestionResult<>(suggestion, query, textComponent);
 selectionListener.selected(result);
 textComponent.requestFocus();
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

public static void display( JTextComponent host, String prefix, Consumer<String> consumer )
{
 GotoProgramTypePopup valuePopup = new GotoProgramTypePopup( prefix );
 valuePopup.addNodeChangeListener(
  e -> {
   String strQualifedType = (String)e.getSource();
   consumer.accept( strQualifedType );
   host.requestFocus();
  } );
 valuePopup.getNameField().setText( prefix );
 valuePopup.show( EditorUtilities.rootPaneForComponent( host ), 0, 0 );
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-propertyeditors

public void addNotify() {
  super.addNotify();
  //force focus to the editable area
  if (isEnabled() && isFocusable()) {
    textArea.requestFocus();
  }
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-editor

@Override
 public void stateChanged( ChangeEvent e )
 {
  TextComponentUtil.replaceWordAtCaretDynamic( getEditor(), e.getSource().toString(),
                         getGosuEditor().getReplaceWordCallback(), false );
  getEditor().requestFocus();
  getGosuEditor().fixSwingFocusBugWhenPopupCloses();
  getEditor().repaint();
 }
} );

代码示例来源:origin: org.gosu-lang.gosu/gosu-editor

public void stateChanged( ChangeEvent e )
 {
  BeanTree beanInfoSelection = (BeanTree)e.getSource();
  String strRef = beanInfoSelection.makePath( false );
  TextComponentUtil.replaceWordAtClosestDot( getEditor(), strRef );
  getEditor().requestFocus();
  getGosuEditor().fixSwingFocusBugWhenPopupCloses();
  getEditor().repaint();
 }
} );

相关文章

JTextComponent类方法