Skip to content

Calculator

lcaron edited this page Jul 5, 2015 · 1 revision

Introduction

https://raw.githubusercontent.com/lcaron/opal/wiki/images/calculator.png https://raw.githubusercontent.com/lcaron/opal/wiki/images/calculatorCombo.png

A simple calculator, displayed as a whole widget or inside a combo.

Usage

This is very simple : you instantiate a Calculator or a CalculatorCombo, then you attach a ModifyListener in order to be informed when the value changed :

final Calculator calc = new Calculator(shell, SWT.NONE);

calc.addModifyListener(new ModifyListener() {

     @Override
     public void modifyText(final ModifyEvent e) {
          System.out.println("New value is " + calc.getValue());
     }
});

And voilà !

Examples

2 examples called CalculatorSnippet.java and CalculatorComboSnippet.java are located in the directory src/test/java/org/mihalis/opal/calculator.

These examples are also available here :

Clone this wiki locally