What’s the use of E. consumer () in Java

I didn't get a clear explanation about the use of e.consumer () when I searched on the Internet. E.consumer () is often used in Java keyevent handle Similar to the following code

public void keyTyped( KeyEvent e ) {
    char c = e.getKeyChar();
    if ( c != KeyEvent.CHAR_UNDEFINED ) {
        s = s + c; 
        repaint();
        e.consume();
    } 
}

Solution

From JavaDocs

In essence, it means that you do not want to dispatch events to any other event listeners

If I remember correctly, the event will be sent in the final way

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>