Automatically transferring the focus when a JTextField column limit has been reached

You can do so by extending JTextField to catch every insertion and checking whether the limit has been reached. If so, you can use transferFocus to have the focus jumpt to the next component.

Main.java:

import javax.swing.text.*;
import java.awt.event.*;
import javax.swing.*;
import java.text.*;
import java.awt.*;
   
public class Main extends JFrame {
   public Main() {
      getContentPane().setLayout(new FlowLayout());
 
      getContentPane().add(new AutoFocusTextField("Try typing more", 15, 20));
      getContentPane().add(new AutoFocusTextField(10, 3));
  
      addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent event) {
            System.exit(0);   
         }      
      });
 
      setSize(300, 300);
   }
 
   public static void main(String[] args) {
      (new Main()).show();
   }
}
 
class AutoFocusTextField extends JTextField
{
   private int maxCols = 0;
 
   public AutoFocusTextField(int maxCols) {
      super();
      this.maxCols = maxCols;
   }
 
   public AutoFocusTextField(int cols, int maxCols) {
      super(cols);
      this.maxCols = maxCols;
   }
  
   public AutoFocusTextField(String text, int maxCols) {
      super();
      this.maxCols = maxCols;
      setText(text);
   } 
 
   public AutoFocusTextField(String text, int cols, int maxCols) {
      super(cols);
      this.maxCols = maxCols;
      setText(text);
   }
 
   protected Document createDefaultModel() {
      return new AutoFocusDocument();
   }
  
   protected class AutoFocusDocument extends PlainDocument {
      public void insertString(int offset, String str, AttributeSet as) 
            throws BadLocationException  {
         if (str == null || getLength() + str.length() <= maxCols) {
            super.insertString(offset, str, as);
            if (offset == maxCols-1) {
               transferFocus();
            }
         }
         else {
            int remainder = maxCols - getLength();
            if (remainder > 0) {
               super.insertString(offset, str.substring(0, remainder), as);
            }
            transferFocus();
         }
      }
   }
}