Tag: jtextcomponent

使用DocumentFilter.FilterBypass

我希望在DocumentFilter上有这样的方法 public void replaceUpdate(int offset, int length, String text) { try { super.replace(byPass, offset, length, text, null); } catch (BadLocationException ex) { //error } } 目前为了获得FilterBypass的实例(上面的方法中的byPass),我需要从重写的方法insertString获取: private FilterBypass byPass; @Override public void insertString(DocumentFilter.FilterBypass fb, int offset, String string, AttributeSet att) throws BadLocationException { byPass = fb; //some stuff here super.insertString(fb, offset, string, att); } 但这给我带来了一些问题。 […]

如何使用TextAction

从AbstractAction使用TextAction的目的是什么? 以及如何将其用于以下内容: 插入符号 在JTextComponents中的选择 键绑定