News for hackers. Stuff that matters.
Re:Show HN: Sierra, a DSL for building Java Swing applications by kitd on Tuesday January 03, 2023 @10:23AM (#34232511)
This looks really cool. Applying a thin layer over parts of the standard library is a very good idea IMO. Reduces the dependency tree but a lot.

One question (my Swing knowledge is at least 15 years old!): what's the simplest way to handle events using this? Eg taking the FormTest [1] example, how might one simply bind a model object to the UI elements?

[1] https://github.com/HTTP-RPC/Sierra/blob/master/sierra-test/s...

Re:Show HN: Sierra, a DSL for building Java Swing applications by gk_brown on Tuesday January 03, 2023 @10:51AM (#34232987)
Great question. You can do this with a cell consumer (i.e. the with() method). See OrientationTest for an example (e.g. leftToRightButton, rightToLeftButton):

https://github.com/HTTP-RPC/Sierra/blob/master/sierra-test/s...

I should probably add a better example.

Re:Show HN: Sierra, a DSL for building Java Swing applications by gk_brown on Tuesday January 03, 2023 @12:37PM (#34234764)
Added an example demonstrating how to add an action listener to a button:

https://github.com/HTTP-RPC/Sierra/blob/master/sierra-test/s...

I'm not sure it's exactly what you were looking for, but hopefully it is similar enough.

Re:Show HN: Sierra, a DSL for building Java Swing applications by kitd on Tuesday January 03, 2023 @01:09PM (#34235248)
That's great! As I say, my swing experience is very old and it's probably just a case of remembering the basic action framework more than anything else.

But that fits in very nicely with how your library works using with().

Re:Show HN: Sierra, a DSL for building Java Swing applications by exabrial on Wednesday January 04, 2023 @10:51AM (#34246991)
I wish there was CDI integration with Swing or JavaFX and you can annotate handlers