Code example for JTextComponent

Methods: getSelectedText

0
  } 
 
  @Override 
  @Nullable 
  public String getSelectedText() {
    return myTextComponent.getSelectedText();
  } 
 
  @Nullable 
  @Override 
  public String getSelectedText(boolean allCarets) {
    return getSelectedText(); 
  } 
 
  @Override 
  public int getLeadSelectionOffset() { 
    final int caretPosition = myTextComponent.getCaretPosition();
    final int start = myTextComponent.getSelectionStart();
    final int end = myTextComponent.getSelectionEnd();
    return caretPosition == start ? end : start;
Experience pair programming with AI  Get Codota for Java