JFrame buttons that change background color of window
问题 I am trying to make a program with buttons, that when you click them, change the background color of the frame import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class ColorFrame { public static void main(String[] args){ JFrame frame = new JFrame(); JPanel panel = new JPanel(); frame.setSize(300, 200); frame.setVisible(true); frame.setDefaultCloseOperation