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

  Create a simple warm-up program using your g3d

Create a simple warm-up program using your G3D programming and graphics environment.

  Shadow effect while rolling a sphere

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

  Relative positioning and interactive positioning

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

  Draw a teapot at the global origin

Draw a teapot at the global origin

  Concepts of computer graphics

Concepts of Computer Graphics and develop a program using OpenGL

  The security policy document outline

Using the GDI Case Study below, complete the Security Policy Document Outline

  Develop the image manipulations

Develop the image manipulations

  What does resolution mean

What does resolution mean How is resolution connected to ppi and dpi units

  Differentiate between a bitmap image and a vector image

Differentiate between a bitmap image and a vector image Explain the following terms

  Essential elements of a design pattern

configuration of an Iterator pattern, patterns could be used in a Library System, Singleton, Template, Decorator, Façade,What does Alexander means by the following declaration "But it is impossible to form anything which has the temperament of natu..

  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..

  What are the factors affecting picture composition

Define picture composition What are the factors affecting picture composition. Elaborate on each factor Describe the basic lines present in a composition

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