Why does the keylistener stop working?
问题 In my Java program, whenever I select some text from a JTextField, the keyListener stops detecting key presses. I noticed the same thing happens when a JButton is pressed. Do I need to remove the keyListener from the objects after using them? If so, how to I do this? Here is a copy of the program I'm having problems with: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class ColourDropper extends JPanel implements KeyListener, ActionListener { private Color background