Code example for JTextComponent

Methods: getCaretPositiongetDocument

0
 
	/** 
	 * {@inheritDoc} 
	 */ 
	public boolean isAutoActivateOkay(JTextComponent tc) {
		Document doc = tc.getDocument();
		char ch = 0;
		try { 
			doc.getText(tc.getCaretPosition(), 1, s);
			ch = s.first();
		} catch (BadLocationException ble) { // Never happens
			ble.printStackTrace();
		} 
		return (autoActivateAfterLetters && Character.isLetter(ch)) ||
				(autoActivateChars!=null && autoActivateChars.indexOf(ch)>-1);
	} 
 
 
	/** 
	 * Sets the characters that auto-activation should occur after.  A Java 
Contextual code suggestions in your IDE  Get Codota for Java