Personally I've always had a through dislike for Swing, and now I'm
looking into its implementation I dislike it even more.  Replacing
Swing entirely would be something I could seriously delve into!

I like the idea of using a XAML style layout-file to create UIs.  A
threadsafe Swing replacement which would parse these at runtime, or
something that would complie a layout-file into bytecode are two
options off the top of my head.  Would most of you like standard
library of windows and dialogs in Clojure? < A list of suggested
essentials windows and dialogs would be appreciated.

Are there any examples of GUI libraries designed for the functional
programming model that you know of I could go examine first?  Purely
from a syntax point of view.  Lispers?  Is there such as thing
already?

- Ande

On Oct 9, 12:16 pm, "Tom Emerson" <[EMAIL PROTECTED]> wrote:
> Putting on a heretical hat, it seems that trying to utilize a GUI
> library designed for Java's imperative programming model from a
> functional language is an exercise in frustration trying to pound a
> square peg through a round whole. While I like Chouser's example (it's
> very cool, and makes a good demo) I'm not sure how realistic this is
> for a non-trivial GUI app. How do people see the thread model used by
> Swing working with Clojure's?
>
> On Wed, Oct 8, 2008 at 6:19 PM, Michael Beauregard
>
>
>
> <[EMAIL PROTECTED]> wrote:
>
> > I spent a few hours writing a macro that would allow a more
> > declarative gui than the usual swing approach. I didn't finish it, but
> > concluded that this could be quite doable. For example, I was aiming
> > for a macro that would allow the following declarative style:
>
> > [Note that I don't have the actual code or example that I had working
> > since that is on my laptop hibernating at home atm.]
>
> > ; rough example
> > (make-ui
> >  '(JFrame {:title "The title"}
> >    (JLabel {:id fooLabel :text "Some label"})
> >    (JButton {:id btn1 :label "Click me" :actionPerformed (fn [evt]
> > (println "clicked")) })
> >    (JButton {:label "Apply" :actionPerformed someFn :enabled false })))
>
> > This doesn't address the functional/stateless impedance mismatch, but
> > would make defining guis simpler. However, the basic idea is to
> > represent the containment hierarchy inherent in a gui with the nesting
> > of lisp expressions. The map of attributes would be applied as setters
> > on each component after it is created. The event handlers such as
> > ":actionPerformed" are harder, but also doable.
>
> > The nasty part that I haven't spent any time thinking about is the
> > LayoutManager gong show in swing. That sounds much harder to solve
> > declaratively without writing a bunch of LMs that support simplifying
> > the declarative style.
>
> > Michael
>
> > On Wed, Oct 8, 2008 at 3:37 PM, Bob <[EMAIL PROTECTED]> wrote:
>
> >> Yes, I'm very interested in this question as well.  I'm learning
> >> clojure and its my first attempt at functional programming.  And I was
> >> thinking of writing a swing GUI program to try it out.  But it would
> >> seem the GUI state is going to be a mass of mutable state which
> >> doesn't map well to the functional style.  What am I missing?  Does
> >> anyone have a non-trivial example of a Swing program done the Clojure
> >> way?
>
> >> Thanks much,
> >> Bob
>
> >> On Oct 8, 2:07 pm, Mitch <[EMAIL PROTECTED]> wrote:
> >>> I'm interested in doing a GUI program in clojure, but the functional
> >>> style of clojure doesn't seem to blend too well with the normal Java
> >>> GUI libraries.  Does anybody have any advice on using clojure for GUI
> >>> programming?  I've seen Rich's ants demo, but that isn't really an
> >>> event driven GUI program (just a nice display for his simulation).
> >>> Has anyone tried using of the GUI building tools for Java with
> >>> clojure?  I feel like these could help a lot, but I'm not sure.
>
> >>> Thanks,
> >>> Mitch
>
> --
> Tom Emerson
> [EMAIL PROTECTED]://www.dreamersrealm.net/~tree
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to