Scroll « JTextField « Java Swing Q&A





2. automatic scrolling of JTextField    coderanch.com

4. JTextField scrolling question?    coderanch.com

import javax.swing.*; import javax.swing.event.*; import javax.swing.text.*; public class CenterCaretListener implements CaretListener { // // Implement CaretListener interface // public void caretUpdate(final CaretEvent e) { // Attempt to scroll the viewport to make sure Caret is visible SwingUtilities.invokeLater(new Runnable() { public void run() { try { JTextComponent component = (JTextComponent)e.getSource(); int width = component.getSize().width; int center = width / 2; int position ...