CellEditor with DocumentFilter never get called

给你一囗甜甜゛ 提交于 2019-12-06 11:11:56

You're incompletely overriding the class. Try this for a change:

private class MyDocumentFilter extends DocumentFilter {

  @Override
  public void insertString(DocumentFilter.FilterBypass fb, int offset,
        String string, AttributeSet attr) throws BadLocationException {

     JOptionPane.showMessageDialog(null, "Enter hereeeeeeeee");

     super.insertString(fb, offset, string, attr);
  }

  @Override
  public void replace(FilterBypass fb, int offset, int length, String text,
        AttributeSet attrs) throws BadLocationException {
     JOptionPane.showMessageDialog(null, "This is really what you should be overriding");
     super.replace(fb, offset, length, text, attrs);
  }

  @Override
  public void remove(FilterBypass fb, int offset, int length)
        throws BadLocationException {
     JOptionPane.showMessageDialog(null, "and don't forget this!");
     super.remove(fb, offset, length);
  }
}

The class has 3 methods that may be overridden, and you've overridden only one of them.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!