Your "formula", e.g. 1*1.20+2.80
is called an expression. It's most likely a String that you input somehow.
The "classic" way to do this is to parse the String into tokens, which in your case will be either numbers or operators. Then an expression evaluator chews on the stream of tokens and comes up with a result you can display.
This is a fair bit of work. Other people have already done it, fortunately. One example I found by Googling for "java expression evaluator" is this: http://lts.online.fr/dev/java/math.evaluator/
It does a lot more than you need. You can either use it as is or fiddle with it first.
Update: Getting number buttons to work.
String fieldContents = "";
JTextField field = new JTextField;
ActionListener acLi = new ActionListener() {
public void actionPerformed(ActionEvent ae) {
JButton btn = (JButton) ae.getSource();
fieldContents += btn.getText();
field.setText(fieldContents);
}
};
JButton button0 = new JButton("0");
button0.addActionListener(acLi);
...
JButton button9 = new JButton("9");
button9.addActionListener(acLi);
That should mostly do it. Enjoy!