List of utility methods to do JTextArea
void | setCaretPosition(int i, int j, JTextArea jtextarea) set Caret Position if (i < 0 || j < 0) return; StringBuffer stringbuffer = new StringBuffer(jtextarea.getText()); int k = 0; int l; for (l = stringbuffer.length(); i > 0 && k < l; k++) if (stringbuffer.charAt(k) == '\n') i--; ... |
void | setCaretPosition(JTextArea ta) set Caret Position ta.setCaretPosition(ta.getDocument().getLength()); |
void | setCeil(final JTextArea textArea) set Ceil SwingUtilities.invokeLater(new Runnable() { public void run() { JViewport v = (JViewport) textArea.getParent(); v.setViewPosition(new Point(0, 0)); }); |
void | setModelValue(JTextArea ta, String value) set Model Value if (value != null) {
ta.setText(value);
|
void | setTextSafe(JTextArea textArea, String value) set the text of a JTextArea without moving the caret normally, setting the text would trigger am event that scrolls the Text Area into view. Caret caret = textArea.getCaret(); caret.setDot(0); textArea.setCaret(null); textArea.setText(value); textArea.setCaret(caret); |
void | showMemo(JTextArea memo, boolean visible) show Memo memo.setVisible(visible); if (memo.getParent() instanceof JScrollPane) memo.getParent().setVisible(visible); else if (memo.getParent().getParent() instanceof JScrollPane) memo.getParent().getParent().setVisible(visible); |
JTextArea | textAreaAsLabel(JTextArea textArea) This will allow selection and copy to work but still retain the label look textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
textComponentAsLabel(textArea);
return textArea;
|
void | validarArticuloDescripcion(JTextArea descripcion, KeyEvent evt) validar Articulo Descripcion char ch = evt.getKeyChar(); if ((descripcion.getText().length() == 500) || ((ch > '9' || ch < '0') && (ch > 'z' || ch < 'a') && (ch > 'z' || ch < 'A') && (ch != KeyEvent.VK_SPACE) && ch != KeyEvent.VK_COMMA && ch != KeyEvent.VK_PERIOD)) { evt.consume(); |
void | validateView(JTextArea view) Validates that the given view is not null and has a Document . if (view == null || view.getDocument() == null) { throw new IllegalArgumentException("Parameter view must not be null and must have a Document."); |