Use UI Component:
import com.programmisty.calc.*;
public class Sample1 {
public static void main(String a[]) throws Exception {
// Change UI Look And Feel (If needed) //UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
JFrame frame = new JFrame("Simple Calculator");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Important! ADD CALCULATOR PANEL
frame.getContentPane().add(new CalculatorPanel());
frame.pack();
frame.setVisible(true);
}
}
Use API :
import com.programmisty.calc.*;
import java.math.BigDecimal;
public class Sample2 {
public static void main(String args[]) throws Exception {
BigDecimal a = Calc.eval("100+100/5");
double x = Calc.deval("100+100/4");
int y = Calc.ieval("100+100/4");
}
}