Examples of RLabel


Examples of fr.cyann.reactdemo.ui.swing.RLabel

    RTextBox tb1 = new RTextBox();
    tb1.setPreferredSize(new Dimension(100, 25));
    RTextBox tb2 = new RTextBox();
    tb2.setPreferredSize(new Dimension(100, 25));
    RLabel lb1 = new RLabel();

    Function1<String, Integer> convertToInt = new Function1<String, Integer>() {

      @Override
      public Integer invoke(String value) {
        try {
          return Integer.valueOf(value);
        } catch (Exception ex) {
          return 0;
        }
      }
    };

    Var<String> res = tb1.getRText().map(convertToInt).merge(0, 0, tb2.getRText().map(convertToInt), new Function2<Integer, Integer, String>() {

      @Override
      public String invoke(Integer a, Integer b) {
        int sum = a + b;
        return a + " + " + b + " = " + sum;
      }
    });

    lb1.setText(res);

    addition.add(new JLabel("Addition"));
    addition.add(tb1);
    addition.add(new JLabel("+"));
    addition.add(tb2);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.