-
Notifications
You must be signed in to change notification settings - Fork 147
Home
- Project Setup
- Frames
- Widgets
- Containers
- Selectors
- Actions
- Handling Events
- Handling Selection
- Dialogs
- Menus
- Colors
- Fonts
- Borders
- Tables
- Graphics
See tests and src/seesaw/examples. Seriously, there are a lot of tests and they're pretty descriptive of how things work.
Let's create a JFrame
:
(frame :title "Hello" :content "Hi there")
This will create a JFrame
with title "Hello" and a single label "Hi there". The :content
property expects something that can be turned into a widget and uses it as the content pane of the frame. Any place where a widget is expected, one will be created depending on the argument (see Widget Coercion below) ...
There are several examples at the moment. They're all in the src/seesaw/examples
and can be run with lein
like this:
$ lein deps
$ lein run -m seesaw.examples.<name-of-example>
To run the tests:
$ java -cp "src:test:classes:lib/*:lib/dev/*" lazytest.watch src test
Hopefully you see a nice wall of green.
Call the (native!)
function early in your program (like before any other Swing or Seesaw function is called) to get a more "native" behavior. This includes correct menu bar placement in OSX, etc.
As noted [here] (http://download.oracle.com/javase/6/docs/api/javax/swing/package-summary.html#threading) Swing is single threaded nearly all UI operations should be executed on the Swing UI dispatch thread. To facilitate this, Seesaw includes the (invoke-now)
and (invoke-later)
macros. The former executes forms on the UI thread and waits for their completion, while the latter simply schedules the forms for execution sometime in the future.
A typical use for (invoke-later)
is to get things going in an app:
(defn -main [& args]
(invoke-later
(frame :title "Hello" :content (button :text "Push me"))))