1

Here is from the seesaw tutorial:

(def rbs (for [i [:source :doc]]
          (radio :id i :class :type :text (name i))))

(display (border-panel
           :north (horizontal-panel :items rbs)
           :center split
           :vgap 5
           :hgap 5
           :border 5))

(select f [:JRadioButton])
(select f [:.type])
(select f [:#source])

When selecting by :class, a dot was added in :type so we got :.type, and when selecting by id, a # was added so we got :#source, why so?

qed
  • 22,298
  • 21
  • 125
  • 196

1 Answers1

0

That's just part of the syntax for selectors that let you specify what you want to select.

The docstring for the select function documents the full selector syntax. I won't copy the entire docstring, but here are some highlights:

[:#id]            ID
[:tag]            "Simple" (not fully-qualified) class name 
[:<class-name>]   Fully-qualified class name; also matches subclasses
[:<class-name!>]  Exact class match
[:.<class>]       "Class" match, as set using :class option
[:*]              Everything

Examples of each:

;; Widget with ID box1.
(select root [:#box1])
;; Class Label, e.g. com.myns.Label or org.foo.Label.
(select root [:Label])
;; javax.swing.text.JTextComponent and descendants.
(select root [:<javax.swing.text.JTextComponent>])
;; Only javax.swing.text.JTextComponent
(select root [:<javax.swing.text.JTextComponent!>])
;; Class class1, e.g. (flow-panel :class :class1)
(select root [:.class1])
;; Everything
(select root [:*])

Note also that these can be combined, e.g.

;; Everything under widgets with class javax.swing.text.JTextComponent
;; (or subclasses) and class input.
(select root [:<javax.swing.text.JTextComponent>.input :*])
John Wiseman
  • 3,081
  • 1
  • 22
  • 31