OOP2

button.java

1
import javax.swing.JButton;
2
3
// Class representing a button on a calculator that adds a number. Its value is passed during instantiation.
4
class NumberButton extends JButton {
5
		private int m_value; // The numeric value this button represents.
6
7
		public NumberButton(int number) {
8
				setText(Integer.toString(number));
9
				m_value = number;
10
		}
11
}
12