I am trying to write a function to simplify working with GridBagConstraints -- that is, instead of writing
(let [c (GridBagConstraints.)] (set! (.weightx c) 2.0) (set! (.gridwidth c) GridBagConstraints/REMAINDER) (let [button (JButton. "Hello, world!")] (.setConstraints (.getLayout *my-container*) button c) (.add *my-container* button))) I could simply write (gridbag-add *my-container* (JButton. "Hello, world!") "weightx=2.0;gridwith=GridBagConstraints/REMAINDER") A simple combination of regexes and read-string would easily allow me to extract the symbol 'GridBagConstraints/REMAINDER from the example string, but I'm having trouble actually converting it into its value. Using resolve simply returns nil, and getting "." to work dynamically seems to be fruitless, as even this simple call (. (resolve 'GridBagConstraints) REMAINDER) throws an exception. So, the question is, how do I go dynamically from a string like "GridBagConstraints/REMAINDER" to the actual value of the static field? Of course, eval does the trick, but I'd rather not have to resort to it. Sorry if the answer is obvious; I'm a Clojure-newbie. --~--~---------~--~----~------------~-------~--~----~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---