Skip to content
daveray edited this page May 24, 2011 · 6 revisions

A typical Swing app will stick everything inside an instance of [JFrame] (http://download.oracle.com/javase/6/docs/api/javax/swing/JFrame.html). Create a JFrame in Seesaw with the (frame) function:

(frame :title "An example", :on-close :exit, :content "Some Content")

The (frame) function will return a instance of JFrame.

(frame) takes a number of options (see the code and tests), but a few are pretty important:

Name Notes
:on-close sets the default behavior when the frame is closed by the user. Valid values are :exit, :hide, :dispose, and :nothing. Note that :exit will cause the entire JVM to exit when the frame is closed, which may be reasonable for a standalone app, but probably isn't for use in the REPL. The default value is `:hide`.
:width Initial width, in pixels of the frame. Note that :pack? must be false for this setting to have an affect
:height Initial height, in pixels of the frame. Note that :pack? must be false for this setting to have an affect
:pack? Whether the frame content should be "packed" when it's first displayed. That is, determine the frame size based on the preferred size of its content. The default is true and will sometimes generate reasonable looking displays.
:visible? If true, the frame is displayed immediately, otherwise it is left hidden. The default value is true.
:content Sets the content of the frame which can be any widget (with widget coercion applied), but is usually a panel of some sort.
Clone this wiki locally