Ejemplo n.º 1
0
 public static void main(String[] args) {
   JFrame frame = new JFrame("redgreen");
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setLayout(new FlowLayout());
   SButton red = new SButton("red");
   SButton green = new SButton("green");
   Stream<String> sRed = red.sClicked.map(u -> "red");
   Stream<String> sGreen = green.sClicked.map(u -> "green");
   Stream<String> sColor = sRed.orElse(sGreen);
   Cell<String> color = sColor.hold("");
   SLabel lbl = new SLabel(color);
   frame.add(red);
   frame.add(green);
   frame.add(lbl);
   frame.setSize(400, 160);
   frame.setVisible(true);
 }
Ejemplo n.º 2
0
 private VTextField(StreamLoop<String> sRemoteWrite, ValueOutput<String> outRemote, int width) {
   super(
       Stream.filterOptional(Operational.value(outRemote.value)),
       "",
       width,
       outRemote.value.map(oV -> oV.isPresent()));
   sRemoteWrite.loop(sUserChanges);
   this.cleanup = outRemote.cleanup;
 }