Enhance the buttonviewer program

Assignment Help Computer Graphics
Reference no: EM13950854

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: EM13950854

Questions Cloud

Does the square magnitude of this complex number depend on x : For Quantum Mechanics, suppose a complex number is such that its real component is cos(x) for any value of x, and its imaginary component is sin(x). Does the square magnitude of this complex number depend on x? Explain why.
Problem regarding the physician referral directory : Recently, the physician marketing task force at state university medical center developed a physician referral directory. And advertisement, the garget was primary care physicians in the region who could refer patients to state university for tert..
Pay today for a share of fancy threads common stock : The owner of Fancy Threads, a national high-end women’s boutique is considering opening a boutique on Grand River Avenue. The company has experienced phenomenal sales growth, and you are considering buying some of their stock. how much would you pay ..
Paid by their employer to carry out a job : A major strategy for helping others grow and develop is to be a nurturing, positive person. Discuss how a nurturing person promotes the growth of others.
Enhance the buttonviewer program : Enhance the ButtonViewer program so that it prints the time at which the button was clicked.
Greatest threats to a computerized accounting system : From the e-Activity, examine the greatest threats to a computerized accounting system. Suggest two (2) preventive measures or remedies to protect the system and / or mitigate negative impact to the system. Provide a rationale for your response.
What is the impact on earnings before interest and taxes : What is the impact on earnings before interest and taxes (EBIT) of the 50% increase/decrease in sales? Explain using the concept of leverage.
Compare and contrast the two selected organizations : Using your current work organization (or an organization of interest) and a second organization in the same industry as the subject matter, research the elements of business, compare and contrast the two selected organizations, and prepare an APA ..
Offered temporary job and will be having cash inflow : You have been offered a temporary job and will be having a cash inflow of $300 in two months from now, $400 in 4 months, and $1,000 in 6 months. Whenever you receive the payments, you plan to deposit in MSUFCU savings account, paying 12% of annual in..

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