Reference no: EM13891657
Enhance the ButtonViewer program so that it prints the time at which the button was clicked.
Use the following class as your main class:
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
/**
This program demonstrates how to install an action listener.
*/
public class ButtonViewer
{
private static final int FRAME_WIDTH = 100;
private static final int FRAME_HEIGHT = 60;
public static void main(String[] args)
{
JFrame frame = new JFrame();
JButton button = new JButton("Click me!");
frame.add(button);
ActionListener listener = new ClickListener();
button.addActionListener(listener);
frame.setSize(FRAME_WIDTH, FRAME_HEIGHT);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
You need to supply the following class in your solution:
ClickListener
Do not modify the following:
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
/**
This program demonstrates how to install an action listener.
*/
public class ButtonViewer
{
private static final int FRAME_WIDTH = 100;
private static final int FRAME_HEIGHT = 60;
public static void main(String[] args)
{
JFrame frame = new JFrame();
JButton button = new JButton("Click me!");
frame.add(button);
ActionListener listener = new ClickListener();
button.addActionListener(listener);
frame.setSize(FRAME_WIDTH, FRAME_HEIGHT);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
Estimate the koyck model
: Table gives the business expenditures for new plant equipment of public utilities Y and the gross national product X, both in billions of dollars, for the United States from 1960 to 1979 - Estimate the Koyck model
|
Find the amplitude time period and maximum speed
: The equation of a particle executing S.H.M is x = 5 sin((TT )t +n/3)). Find the amplitude , time period and maximum speed also find velocity at t = 1sec
|
Anova for statistics marketing class
: Need to do a 1 way anova for statistics marketing class . Looking at 3 different display locations in a store: on the shelf, aisle end cap, at entrance. Five stores in different areas where looked at. Each store will use each location for a period o..
|
Advantages of using this type of financing for the firm?
: What are the advantages and disadvantages of using this type of financing for the firm?
|
Enhance the buttonviewer program so that it prints the time
: Enhance the ButtonViewer program so that it prints the time at which the button was clicked.
|
Calculate the time period of small oscillations
: A simple pendulum is taken at a place whe re its separation from the earth's surface is equal to the radius of the earth. Calculate the time period of small oscillations
|
Prepare a paper about prepare to demoush application silos
: Prepare a critical thinking paper about the following topics- "Expectation and reality in ERP implementation: consultant and solution provider perspective" and "PREPARE TO DEMOUSH APPLICATION SILOS",
|
Pacita abad and shahzia sikander are international artists
: Both Pacita Abad and Shahzia Sikander are international artists with widely varying body of works. In these two pieces, I Thought the Streets Were Paved with Gold and Pleasure Pillars, they address the experience of moving between cultures in widely ..
|
Method of investigation
: Summarize the article (1-2 paragraphs) Analyze the article, examining the strength of its thesis/hypothesis, method of investigation, analysis of data, and conclusions (4-5 paragraphs)
|