Java: Moving second rectangle using different keys with KeyListener
问题 I am making a little program where two rectangles drive around a race car track. When I run the program everything goes as planned and I can move the black rectangle around the track using the arrow keys. If I want to move the red rectangle using W,A,S,D, what should I do? import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.awt.geom.*; public class first extends JLabel implements ActionListener, KeyListener { Timer t = new Timer(5, this); double x = 0, y = 25, velx =