Java program to design mini calculator with add and sub function
import javax.swing.*; import java.awt.event.*; public class JavaApplication5 { public static void main(String[] args) { JFrame f = new JFrame(); f.setLayout(null); JLabel lab1 = new JLabel("Enter Number 1: "); JLabel lab2 = new JLabel("Enter Number 2: "); JLabel lab3 = new JLabel("Result: "); final JTextField text1 = new JTextField(20); final JTextField text2 = new JTextField(20); final JTextField text3 = new JTextField(20); JButton b1 = new JButton("Add"); JButton b2 = new JButton("Subtract"); lab1.setBounds(20, 20, 100, 20); text1.setBounds(140, 20, 100, 20); lab2.setBounds(20, 50, 100, 20); text2.setBounds(140, 50, 100, 20); lab3.setBounds(20, 80, 100, 20); text3.setBounds(140, 80, 100, 20); b1.setBounds(50, 120, 80, 20); b2.setBounds(150, 120, 90, 20); b1.addActionListener((Actio