Enhance the buttonviewer program so that it prints the time

Assignment Help Computer Graphics
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);
}
}

Reference no: EM13891657

Questions Cloud

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)

Reviews

Write a Review

Computer Graphics Questions & Answers

  What is the purpose of vendor account groups?

What is the purpose of Vendor Account Groups?

  Develop a grayscale image consisting of grid

Develop a grayscale image consisting of an 8 x 8 grid with vertical line in the first column. Compress into JPEG format and decompress.

  Shadow effect while rolling a sphere

Shadow effect while rolling a sphere as well as the options of shading and lighting.

  How to work on datasturetur assignment how to work on

how to work on datasturetur assignment how to work on datasturetur assignment how to work on datasturetur assignment

  Create a complex vector illustration drawing an object

create a complex vector illustration of your own, drawing an object or group of objects designed with a background in Adobe Illustrator. Or, you may draw a portrait or scene

  Concepts of computer graphics

Concepts of Computer Graphics and develop a program using OpenGL

  Modify the single-cycle datapath to implement ''add tozero''

Modify the single-cycle datapath to implement an instruction called 'add to zero' (addz). The 'addz' instruction adds two registers and stores the result in a register and also in the memory at address zero.

  Website template design

Recognize a few sites that appear to be designed using either a template or style sheet. What types of documents lend themselves easily to templates?

  Framework of user interface design

design of user interfaces, natural mapping, GUI applications, web page design different to designing for printed media, risks exposed in this "phone as individual proxy" approach, interaction designers of ubicomp applications, Storyboards are usual..

  Gui that takes text input from the user for name

You have a GUI that takes text input from the user for name, favorite color, and favorite food. On the GUI, the user will click "Enter the Information.

  Write a gui-based program that analyzes a round of golf

Write a GUI-based program that analyzes a round of golf. You will retrieve the data from 18 holes from a text file. On each line in the file will be the par for the hole(3, 4, or 5) and your score for that hole. Your program should read the file a..

  Relative positioning and interactive positioning

Relative Positioning and Interactive Positioning by Dragging and Clicking and some Simple Animation

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd