Explore BrainMass

Explore BrainMass

    Java Program to Monitor User's Clicks

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Create a click tracker program as shown in the examples below.
    Basic capability:
    Write a complete program that monitors a user's clicks on a grid of nine buttons. When a button is clicked, change its label to "Clicked!".

    © BrainMass Inc. brainmass.com October 9, 2019, 10:22 pm ad1c9bdddf


    Solution Preview

    Please see the attachment.

    // ClickTracker.java

    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.*;
    import java.awt.event.*;

    public class ClickTracker extends JApplet {
    private JButton[] buttons;
    private JLabel[] labels;
    private Container cp = getContentPane();

    class ButtonListener implements ActionListener {
    public void actionPerformed(ActionEvent e) {
    JButton button = (JButton) e.getSource();
    if ...

    Solution Summary

    This solution contains a java program that monitor's a user's clicks on a grid of nine buttons.