Explain eventhandling concepts in java

Assignment Help JAVA Programming
Reference no: EM13940572

Enhance the ButtonViewer program so that it prints the time at which the button was clicked.
Please provide the ClickListener class in your solution.

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);
}
}

Reference no: EM13940572

Questions Cloud

Determine the changes in the prime rate that have occurred : Review a current issue of the Federal Reserve Bulletin, or review of copy from the Fed's Web site (www.federalreserve.gov) or the St. Louis Fed's Web site (www.stlouisfed.org). And Determine the changes in the prime rate that have occurred since the ..
Prepare a scattergraph using all twelve months of data : Prepare a scattergraph using all 12 months of data. What step might Tracy, using her judgment, take to amend the results from the method of least squares?
Develop a powerpoint presentation on the bernie madoff : Assume you are an instructor presenting an unethical case study to your graduate students. Develop a PowerPoint presentation on the Bernie Madoff. Be certain to address the following key components for your student audience:
Prepare a cost formula for the receiving activity : Using the high-low method, prepare a cost formula for the receiving activity. Using this formula, what is the predicted cost of receiving for a month in which 1,450 receiving orders are processed?
Explain eventhandling concepts in java : Enhance the ButtonViewer program so that it prints the time at which the button was clicked.Please provide the ClickListener class in your solution.
Provide a background of the firm industry economy : Provide a background of the firm, industry, economy, and outlook for the future Analyze the short term liquidity of the firm Analyze the operating efficiency of the firm Analyze the capital structure of the firm Analyze the profitability of the firm ..
Write a test application named simpledatetest : Write a test application named SimpleDateTest that demonstrates class SimpleDate's capabilities
Explaining the concepts of efficiency and effectiveness : What political consequences might result from an unfavorable opinion of your department? Describe how the Sheriff's department would measure efficiency and effectiveness.
Strategic management process at sector : 1. Provide a critical insight into the strategic management process at sector/business level 2. Clearly identify and appraise the strategic environment and factors which should be considered when evaluating the global diamond market.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Setting up the form page

Download and save the attached comment CGI mailer script form-mail2.pl to your server's cgi-bin directory, and change the permissions on the script to make it executable (not writable).

  Create a program that develops an amortization schedule

Create a program that develops an amortization schedule. Your program should be written as a Java applet.

  Create a java class named headphone

Create a Java class named HeadPhone to represent a headphone set. The class contains: ? Three constants named LOW, MEDIUM and HIGH with values of 1, 2 and 3 to denote the headphone volume.

  Method that reflects overloading

Example of a method that reflects overloading, and one that reflects polymorphism

  Assignment on java applets and activex controls

Go online and search for information about security threats posed by Java applets and ActiveX controls. Note that most of these programs are small in size and downloaded onto computers over the Internet.

  What is an infinite loop

What is an "off-by-one error"? Give an example for it from your experience.What is an infinite loop? Write a for statement to demonstrate it.

  Correct example of inheritance

Which of the following relationships is not a correct example of inheritance?  Parent to Children  Aunt to Uncle  Grandparent to Grandchild

  Create a website

The preplanning design consists of a document that defines the element specifically requested by the client and indicates where these features will be located on the Website

  Create a java class namedtextprocessorgui

Create a Java class namedTextProcessorGUI. Provide a main() function that creates and displays an instance ofTextProcessorGUI. I recommend you write this class as a subclass ofJFrame.

  Design a class named magazinesubscription

Design a class named MagazineSubscription that has fields for a subscriber's name, the magazine name, and number of months remaining in the subscription.

  Calculates the square root of each number

Write a Java program that reads in 10 integers and displays the biggest and second biggest number from them.

  User interface menu using doubly linked lists

Each mNode defines the main menu item name, two links to its mNode neighbors (the previous and next mNode) and a link to its first submenu node.

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