Question
In Java: I have the GO! button but now I am trying to make a WAIT! and STOP! button too... can someone show me the
In Java: I have the "GO!" button but now I am trying to make a "WAIT!" and "STOP!" button too... can someone show me the code on how I make the 2 buttons??
This is what I have:
import java.awt.*; import javax.swing.*;
class ButtonFrame extends JFrame { JButton bChange ; // reference to the button object
// constructor for ButtonFrame ButtonFrame(String title) { super( title ); // invoke the JFrame constructor setLayout( new FlowLayout() ); // set the layout manager
bChange = new JButton("GO!"); // construct a JButton add( bChange ); // add the button to the JFrame setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); } }
public class ButtonDemo { public static void main ( String[] args ) { ButtonFrame frm = new ButtonFrame("Button Demo");
frm.setSize( 150, 75 ); frm.setVisible( true ); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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