Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed
image text in transcribed
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

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions