@Test public void testCalculationLabel() { final EventList<Float> source = new BasicEventList<>(); source.add(new Float(1)); final Calculation<Float> mean = Calculations.meanFloats(source); final JLabel label = new JLabel(); final JLabel formattedLabel = new JLabel(); final NumberFormat formatter = DecimalFormat.getNumberInstance(Locale.US); formatter.setMinimumFractionDigits(2); formatter.setMaximumFractionDigits(2); CalculationsSwing.bind(label, mean); CalculationsSwing.bind(formattedLabel, mean, formatter); assertEquals("1.0", label.getText()); assertEquals("1.00", formattedLabel.getText()); source.add(new Float(12)); assertEquals("6.5", label.getText()); assertEquals("6.50", formattedLabel.getText()); source.clear(); assertEquals("", label.getText()); }
public static void bind(JLabel label, Calculation<?> calculation) { bind(label, calculation, null); }
CalculationsSwing { public static void bind(JLabel label, Calculation<?> calculation) { bind(label, calculation, null); } }
CalculationsSwing { public static void bind(JLabel label, Calculation<?> calculation) { bind(label, calculation, null); } private  CalculationsSwing(); }
CalculationsSwing { public static void bind(JLabel label, Calculation<?> calculation) { bind(label, calculation, null); } private  CalculationsSwing(); static Calculation<E> swingThreadProxyCalculation(Calculation<? extends E> source); static boolean isSwingThreadProxyCalculation(Calculation calc); static void bind(JLabel label, Calculation<?> calculation); static void bind(JLabel label, Calculation<?> calculation, Format formatter); }
CalculationsSwing { public static void bind(JLabel label, Calculation<?> calculation) { bind(label, calculation, null); } private  CalculationsSwing(); static Calculation<E> swingThreadProxyCalculation(Calculation<? extends E> source); static boolean isSwingThreadProxyCalculation(Calculation calc); static void bind(JLabel label, Calculation<?> calculation); static void bind(JLabel label, Calculation<?> calculation, Format formatter);  }