@Override public void focusGained(FocusEvent arg0) { DialogTranslate.this.textToTranslate[0].getCaret().setVisible(true); DialogTranslate.this.textToTranslate[0].getCaret().setSelectionVisible(true); } });
@Override public void focusGained(FocusEvent arg0) { browser.getCaret().setVisible(true); browser.getCaret().setSelectionVisible(true); } });
@Override public void focusGained(FocusEvent arg0) { text[0].getCaret().setVisible(true); text[0].getCaret().setSelectionVisible(true); } });
@Override public void focusGained(FocusEvent arg0) { JPopupTextPane.this.getProxy().getCaret().setVisible(true); JPopupTextPane.this.getProxy().getCaret().setSelectionVisible(true); } });
@Override public void focusGained(FocusEvent arg0) { JPopupTextArea.this.getProxy().getCaret().setVisible(true); JPopupTextArea.this.getProxy().getCaret().setSelectionVisible(true); } });
@Override public void focusGained(FocusEvent arg0) { JColoredConsole.this.getProxy().getCaret().setVisible(true); JColoredConsole.this.getProxy().getCaret().setSelectionVisible(true); } });
textArea.getCaret().setSelectionVisible(true);
textArea.getCaret().setSelectionVisible(true); if (forward && start>-1) { result.getMatchRange().translate(start);
@Override public void focusGained(FocusEvent e) { Caret caret = comp.getCaret(); caret.setVisible(true); caret.setSelectionVisible(true); } };
private void findNext() { JTextArea currentArea = getCurrentArea(); if ( currentArea == null ) return; String query = findField.getText(); if ( query.length() == 0 ) return; Caret caret = currentArea.getCaret(); int from = Math.max( caret.getDot(), caret.getMark() ); Pattern ptn = Pattern.compile( "(?i)"+ Pattern.quote( query ) ); Matcher m = ptn.matcher( currentArea.getText() ); if ( m.find(from) ) { caret.setDot( m.start() ); caret.moveDot( m.end() ); caret.setSelectionVisible( true ); } }
/** * @param currentResult * @param offset * @return the start position of the selected text */ private int updateStateAfterFound(MatchResult currentResult, final int offset) { int end = currentResult.end() + offset; int found = currentResult.start() + offset; select(found, end); getCaret().setSelectionVisible(true); lastFoundIndex = found; lastMatchResult = currentResult; lastRegEx = ((Matcher) lastMatchResult).pattern().pattern(); return found; }
/** * @param currentResult * @param offset * @return the start position of the selected text */ private int updateStateAfterFound(MatchResult currentResult, final int offset) { int end = currentResult.end() + offset; int found = currentResult.start() + offset; select(found, end); getCaret().setSelectionVisible(true); lastFoundIndex = found; lastMatchResult = currentResult; lastRegEx = ((Matcher) lastMatchResult).pattern().pattern(); return found; }
/** * @param currentResult * @param offset * @return the start position of the selected text */ private int updateStateAfterFound(MatchResult currentResult, final int offset) { int end = currentResult.end() + offset; int found = currentResult.start() + offset; select(found, end); getCaret().setSelectionVisible(true); lastFoundIndex = found; lastMatchResult = currentResult; lastRegEx = ((Matcher) lastMatchResult).pattern().pattern(); return found; }
public void selectTextRange(int start, int end) { textPane.setCaretPosition(start); textPane.moveCaretPosition(end); textPane.getCaret().setSelectionVisible(true); scrollCenterToPosition(start, false); }
/** * @param currentResult * @param offset * @return the start position of the selected text */ private int updateStateAfterFound(MatchResult currentResult, final int offset) { int end = currentResult.end() + offset; int found = currentResult.start() + offset; select(found, end); getCaret().setSelectionVisible(true); lastFoundIndex = found; lastMatchResult = currentResult; lastRegEx = ((Matcher) lastMatchResult).pattern().pattern(); return found; }
/** * @param currentResult * @param offset * @return the start position of the selected text */ private int updateStateAfterFound(MatchResult currentResult, final int offset) { int end = currentResult.end() + offset; int found = currentResult.start() + offset; select(found, end); getCaret().setSelectionVisible(true); lastFoundIndex = found; lastMatchResult = currentResult; lastRegEx = ((Matcher) lastMatchResult).pattern().pattern(); return found; }
@Override public void actionPerformed(ActionEvent e) { ParamInstance pi = paramListModel.getParamInstance(listValues.getSelectedIndex()); if (pi != null) { Caret caret = textAreaRequest.getCaret(); caret.setSelectionVisible(true); caret.setDot(pi.getValueStart()); caret.moveDot(pi.getValueEnd()); } } });
public void actionPerformed(ActionEvent evt, JTextComponent target) { if (target != null) { Caret caret = target.getCaret(); try { if (caret.isSelectionVisible()) { caret.setSelectionVisible(false); // unselect if anything selected } else { // selection not visible int block[] = Utilities.getIdentifierBlock((BaseDocument)target.getDocument(), caret.getDot()); if (block != null) { caret.setDot(block[0]); caret.moveDot(block[1]); } } } catch (BadLocationException e) { target.getToolkit().beep(); } } } }
/** Highlights the specified element in the abc tune notation. * @param elmnt The element to be highlighted in the abc tune notation. */ public void setSelectedItem(PositionableInCharStream elmnt) { CharStreamPosition pos = null; if (elmnt != null) pos = elmnt.getCharStreamPosition(); if (pos != null) { int begin = pos.getStartIndex(); int end = pos.getEndIndex(); try { setCaretPosition(end); moveCaretPosition(begin); getCaret().setSelectionVisible(true); repaint(); } catch (IllegalArgumentException ignored) {} } }