Question: BabyControlPanel2 BabyButtonDriver2 DisplayWindow } } import java.awt.*; import javax.swing. * import java.awt.event.*Ineeded for event handling public class BabyControlPane12 extends JPanel implements ActionListenerf JButton quit -
BabyControlPanel2

BabyButtonDriver2

DisplayWindow


}
}
import java.awt.*; import javax.swing. * import java.awt.event.*Ineeded for event handling public class BabyControlPane12 extends JPanel implements ActionListenerf JButton quit - new JButton"Quit"); // make button object JButton blue new JButton("Blue"); // make button to change color public BabyControlPanel2 ()1 // constructor setPreferredSize(new Dimension (700,300)); setBackground ( Color . red ) this.add (quit); I/ place button in panel this.add(blue) I/add blue button quit.addActionListener (this)/panel is listener for button blue.addActionListener (this)/panel 1istener for blue button public void actionPerformed (ActionEvent e)lwhat happens if (e.getSourcequit) // when panel hears button System.exit(0); if (e.getSourceblue) /7 when panel hears button setBackground(Color.blue)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
