if (t != null) { try { int pos = t.getCaret().getDot(); if (pos < t.getDocument().getEndPosition().getOffset()) { t.getDocument().remove(t.getCaret().getDot(), 1); } } catch (BadLocationException e) {  } }
try {   Point p = t.modelToView(t.getCaret().getDot()).getLocation(); int cur = t.getCaretPosition(); int y = p.y; while (y == p.y && cur > 0) y = t.modelToView(--cur).getLocation().y; if (cur != 0) cur++; t.setCaretPosition(cur); } catch (BadLocationException ble) {  }
      public void actionPerformed(ActionEvent event)      {        JTextComponent t = getTextComponent(event);        if (t != null)          {            try              {                int pos = t.getCaret().getDot();                if (pos < t.getDocument().getEndPosition().getOffset())                  {                    t.getDocument().remove(t.getCaret().getDot(), 1);                  }              }            catch (BadLocationException e)              {                // FIXME: we're not authorized to throw this.. swallow it?              }          }      }