on-internet
← Community

Incrementing/Decrementing using JPanel and JButton

Stack Overflow ·

I have been trying to solve this for quite some time now and I can't figure out what am I doing wrong here Here is the code: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class PushCounterPanelMath extends JPanel { private int count; private JButton inc; private JButton dec; private JLabel label; public PushCounterPanelMath() { count = 0; inc = new JButton("Increment"); dec = new JButton("Decrement"); label = new JLabel(); inc.addActionListener(new ButtonListener()); dec.addActionListener(new ButtonListener()); add(inc); add(dec); add(label); setBackground(Color.cyan

Comments

Sign in or sign up to comment and upvote.

No comments yet.