Descripción
Sintaxis
@JavaBean(defaultProperty="UI") public abstract class JTextComponent extends JComponent implements Scrollable, Accessible
Constructores
Campos
Métodos
- addCaretListener()
- addKeymap()
- copy()
- cut()
- fireCaretUpdate()
- getAccessibleContext()
- getActions()
- getCaret()
- getCaretColor()
- getCaretListeners()
- getCaretPosition()
- getDisabledTextColor()
- getDocument()
- getDragEnabled()
- getDropLocation()
- getDropMode()
- getFocusAccelerator()
- getHighlighter()
- getKeymap()
- getMargin()
- getNavigationFilter()
- getPreferredScrollableViewportSize()
- getPrintable()
- getScrollableBlockIncrement()
- getScrollableTracksViewportHeight()
- getScrollableTracksViewportWidth()
- getScrollableUnitIncrement()
- getSelectedText()
- getSelectedTextColor()
- getSelectionColor()
- getSelectionEnd()
- getSelectionStart()
- getText()
- getToolTipText()
- getUI()
- isEditable()
- loadKeymap()
- modelToView()
- modelToView2D()
- moveCaretPosition()
- paramString()
- paste()
- print()
- read()
- removeCaretListener()
- removeKeymap()
- replaceSelection()
- restoreComposedText()
- saveComposedText()
- select()
- selectAll()
- setCaret()
- setCaretColor()
- setCaretPosition()
- setDisabledTextColor()
- setDocument()
- setDragEnabled()
- setDropMode()
- setEditable()
- setFocusAccelerator()
- setHighlighter()
- setKeymap()
- setMargin()
- setNavigationFilter()
- setSelectedTextColor()
- setSelectionColor()
- setSelectionEnd()
- setSelectionStart()
- setText()
- setUI()
- updateUI()
- viewToModel()
- viewToModel2D()
- write()
Ejemplo
editor = new JTextArea();
editor.addCaretListener(new CaretListener() {
public void caretUpdate(CaretEvent e) {
JTextArea editArea = (JTextArea)e.getSource();
int linea = 1;
int columna = 1;
try {
int caretpos = editArea.getCaretPosition();
linea= editArea.getLineOfOffset(caretpos);
columna = caretpos - editArea.getLineStartOffset(linea);
linea += 1;
} catch(Exception ex) { }
}
});
add(editor, BorderLayout.CENTER);
Líneas de Código
Vídeos Java
Disfruta también de nuestros artículos sobre Java en formato vídeo. Aprovecha y suscribete a nuestro canal.