Improved handling of backspace based on my understanding
of various known Java bugs. Those who mess around with backspace take note of the following: The Java bug database has several related bugs concerning the treatment of backspace. Here I adopt solution based on fix of bug 4402080: Evaluation The text components now key off of KEY_TYPED with a keyChar == 8 to do the deletion. The motivation for this can be found in bug 4256901. xxxxx@xxxxx 2001-01-05
This commit is contained in:
parent
e7684dedcd
commit
275cf9d79d
1 changed files with 9 additions and 42 deletions
|
@ -43,7 +43,7 @@ import org.thdl.util.StatusBar;
|
|||
* @author Edward Garrett, Tibetan and Himalayan Digital Library
|
||||
* @version 1.0
|
||||
*/
|
||||
public class DuffPane extends TibetanPane implements FocusListener, KeyListener {
|
||||
public class DuffPane extends TibetanPane implements FocusListener {
|
||||
/**
|
||||
* The status bar to update with messages about the current input mode.
|
||||
* Are we expecting a vowel? a subscript? et cetera.
|
||||
|
@ -294,8 +294,13 @@ public class DuffPane extends TibetanPane implements FocusListener, KeyListener
|
|||
|
||||
caret = getCaret();
|
||||
|
||||
addKeyListener(this);
|
||||
addFocusListener(this);
|
||||
addKeyListener(new KeyAdapter() {
|
||||
public void keyPressed(KeyEvent kev) {
|
||||
if (kev.isActionKey() || kev.getKeyCode() == KeyEvent.VK_BACK_SPACE)
|
||||
initKeyboard();
|
||||
}
|
||||
});
|
||||
|
||||
setupKeymap();
|
||||
}
|
||||
|
@ -1137,44 +1142,6 @@ public void paste(int offset) {
|
|||
isCutAndPasteEnabled = false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Required by contract with the KeyListener interface,
|
||||
* this method initializes the keyboard
|
||||
* when an action key is pressed. It leaves the
|
||||
* behavior up to the Keymap of this DuffPane.
|
||||
*/
|
||||
public void keyPressed(KeyEvent e) {
|
||||
// FIXME: exceptions thrown here do not cause the program to fail, even in development mode.
|
||||
|
||||
if (e.isActionKey())
|
||||
initKeyboard();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Required by contract with the KeyListener interface,
|
||||
* this method does nothing.
|
||||
*
|
||||
* @param e a KeyEvent
|
||||
*/
|
||||
public void keyTyped(KeyEvent e) { }
|
||||
|
||||
|
||||
/**
|
||||
* Required by contract with the Key Listener interface,
|
||||
* this method initializes the keyboard if the user presses
|
||||
* backspace.
|
||||
*
|
||||
* @param e the KeyEvent
|
||||
*/
|
||||
public void keyReleased(KeyEvent e) {
|
||||
// FIXME: exceptions thrown here do not cause the program to fail, even in development mode.
|
||||
|
||||
if (e.getKeyCode() == KeyEvent.VK_BACK_SPACE)
|
||||
initKeyboard();
|
||||
}
|
||||
|
||||
private void processRomanChar(String key, MutableAttributeSet attSet) {
|
||||
switch (key.charAt(0)) {
|
||||
case KeyEvent.VK_BACK_SPACE:
|
||||
|
|
Loading…
Reference in a new issue