Answered step by step
Verified Expert Solution
Question
1 Approved Answer
12. When the following Java program runs, two buttons will be displayed on a frame. What are the captions of the two buttons? What will
12. When the following Java program runs, two buttons will be displayed on a frame. What are the captions of the two buttons? What will happen when the first button is clicked? What will happen when the second button is clicked? import javax.swing.* import java.awt. import java.awt.event. /l Create two buttons private JButton jbtOk - new JButton"Democratic") private JButton jbtCancel- new JButton("Republic"); Default constructor / public TestActionEventO // Set the window title setTitle("TestActionEvent"); I/ Set FlowLayout manager to arrange the components I/ inside the frame setLayout(new FlowLayout0); Il Add buttons to the frame addGbtOk); add(jbtCancel); // Create a listener object ButtonListener btListener new ButtonListener0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started