t.moveCaretPosition(0);
try { if (t != null) { Caret c = t.getCaret(); int x = c.getMagicCaretPosition().x; int pos = Utilities.getPositionBelow(t, t.getCaretPosition(), x);  if (pos > -1) t.moveCaretPosition(pos); } } catch(BadLocationException ble) {  }
      public void actionPerformed(ActionEvent event)      {        JTextComponent t = getTextComponent(event);         t.moveCaretPosition(0);      }