In JavaScript, I entered a code which opens a Paint JFrame. I made a separate JFrame to change the colour. The button says 'Change Colour' which I plan to write a code which goes to the next colour when clicked. However, I do not know how to make a keypress detection. This is my code:
import javax.swing.*;
public class PaintApp extends javax.swing.JFrame {
public static void main(String[] args) {
JFrame main=new JFrame("Tessellating Pi - Paint");
PaintInterface pi=new PaintInterface();
main.add(pi);
main.setSize(1000,1000);
main.setVisible(true);
JFrame j=new JFrame("Colour Chooser");
JButton c=new JButton("Change Colour");
j.add(c);
j.setSize(150,100);
j.setVisible(true);
}
}