Making a Dialog Box popup when button is clicked (Seesaw)

342 Views Asked by At

Im making a simple GUI interface where a user can add/remove a person. I have my GUI set up where there is a table of People with three fields: Name, Age, and Likes.

I have a button called Add Person which I would like to have a dialog box pop up. However, I get the error:

Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: No im plementation of method: :visible! of protocol: #'seesaw.core/Showable found for class: guidemo.core$add_person

I don't know where to use the visible! option. I have the following code for my dialog box:

(defn add-person [person] 
;(seesaw/frame :title "Add New Person" :on-close :exit :content 
  (seesaw/dialog :content 
    (seesaw/flow-panel :items
              ["Name:"  (seesaw/text :id :title)
               ;"Age:" (seesaw/text :id :age)
               ;"Likes:" (seesaw/text :id :likes)
               ])
    :option-type :ok-cancel)
    :success-fn (fn [p] (seesaw/text (seesaw/select (seesaw/to-root p) [:#name ] ))) 
    (seesaw/show! add-person))

I got this example off of the seesaw api to start myself with something. I commented out the frame because adding containers on top of another container is not allowed and I commented out the other fields for now. I know the 'success-fn` does not add anything to a table, but I am more concerned with getting a popup window to appear when a button is clicked.

My code of my button is:

(def add-button
  (seesaw/button
    :text "Add New Person"
    :listen [:mouse-pressed add-person]
    :popup add-person))

I am able to use seesaw/inputs to create a simple input box with one field, however I want to have one with three fields. Is there a way around this? (and yes I tried 3 input boxes, but they pop up one at a time and its very unintuitive)

0

There are 0 best solutions below