diff options
author | scgilardi <scgilardi@gmail.com> | 2009-05-31 07:13:57 +0000 |
---|---|---|
committer | scgilardi <scgilardi@gmail.com> | 2009-05-31 07:13:57 +0000 |
commit | ef15d24e7970d398ebaffae3a34cf529d9b291e0 (patch) | |
tree | 03edabbdc534afe662c017f08b178be5fbb438c8 /src/clojure | |
parent | 6efe93a019fbd037889e57325f4cdb2063fd8a2d (diff) |
miglayout.example: cleanup
Diffstat (limited to 'src/clojure')
-rw-r--r-- | src/clojure/contrib/miglayout/example.clj | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/clojure/contrib/miglayout/example.clj b/src/clojure/contrib/miglayout/example.clj index 8fe4b614..45b44370 100644 --- a/src/clojure/contrib/miglayout/example.clj +++ b/src/clojure/contrib/miglayout/example.clj @@ -15,25 +15,23 @@ ;; Created 31 May 2009 (ns clojure.contrib.miglayout.example - (:import (javax.swing JButton JFrame JLabel JPanel JTextField) - (java.awt.event ActionListener)) + (:import (javax.swing JButton JFrame JLabel JPanel JTextField)) (:use (clojure.contrib [miglayout :only (miglayout components)] [swing-utils :only (add-action-listener)]))) (defn fahrenheit - "Converts a string containing a Celsius temperature to a string - containing a Fahrenheit temperature. Returns \"input?\" if the - input can't be read" - [c-str] + "Converts a Celsius temperature to Fahrenheit. Input and output are + strings. Returns \"input?\" if the input can't be parsed as a Double." + [celsius] (try (format "%.2f \u00b0Fahrenheit" - (+ 32 (* 1.8 (Double/parseDouble c-str)))) + (+ 32 (* 1.8 (Double/parseDouble celsius)))) (catch NumberFormatException _ "input?"))) (defn main - "Creates a converter UI" + "Lays out and displays the Temperature Converter UI" [] (let [panel (miglayout (JPanel.) |