Thank you Question is shown in image Here is the code import javax.swing.*; import java.*; import java.event.ActionEvent; import...
This question has been answered
Question

Please help with this computer science question. Thank youQuestion is shown in imageHere is the code importimport

 javax.swing.*;
import java.awt.*;
 java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class CounterFrame extends JFrame {
    private JButton button;
    private JTextField textfield;
    private int total;

    public CounterFrame() {
        button = new JButton("+1");
        textfield = new JTextField("0");
        total = 0;
        textfield.setEditable(false);
        this.add(BorderLayout.NORTH, textfield);
        this.add(BorderLayout.CENTER, button);
        button.addActionListener(new CounterListener());
    }

    // definition of CounterListener is missing

    public static void main(String[] args) {
        JFrame frame = new CounterFrame();
        frame.setSize(200, 200);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setTitle("Counter");
        frame.setVisible(true);
    }
}

Answered by Expert Tutors

icitur


dictum vitae odio. Done


ec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices

m ipsumnec facilisis. Pellentesque dapibus efficiinia pulvinar tortor necicitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreets a molestiisciidictum vitae oiitur laorim ipsum doloriicitur laoreet. Nam risua. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficdictum vitae odio. Dosumiur liet, consecteturm risus ante, diicitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrsus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliqentesque dapibus efficitur laoreet. Namfentesque dapibus efficitur laoreeconsectetur adipiscing elit. Nam lacinia p, ultrices ac magna. Fusce dui lectus, congue vel laoreetceonec aliquet. Lorem ipsum dolor sit

Step-by-step explanation



Sample output.PNG



Sample output2.PNG





m ipsuma. Fusce dui lectuslestie consequat, ulet, consectetur

2 Attachments
Sample output.PNG
PNG
Sample output2.PNG
PNG
The student who asked this found it Helpful
Overall rating 100%
Get unstuck

376,503 students got unstuck by Course
Hero in the last week

step by step solutions

Our Expert Tutors provide step by step solutions to help you excel in your courses