Mercurial > hg > indyvon
changeset 165:421dba17b7ed
Function to show View in a JFrame.
author | Mikhail Kryshen <mikhail@kryshen.net> |
---|---|
date | Wed, 26 Nov 2014 19:22:52 +0300 |
parents | d91a7e0388da |
children | c5b37c658161 |
files | src/indyvon/component.clj |
diffstat | 1 files changed, 12 insertions(+), 1 deletions(-) [+] |
line diff
1.1 --- a/src/indyvon/component.clj Tue Nov 25 17:18:48 2014 +0300 1.2 +++ b/src/indyvon/component.clj Wed Nov 26 19:22:52 2014 +0300 1.3 @@ -22,7 +22,7 @@ 1.4 (:use 1.5 indyvon.core) 1.6 (:import 1.7 - (java.awt Graphics Component Dimension Color) 1.8 + (java.awt Graphics Component Dimension Color EventQueue) 1.9 (java.awt.geom Rectangle2D$Double) 1.10 (javax.swing JFrame JPanel JOptionPane))) 1.11 1.12 @@ -65,5 +65,16 @@ 1.13 (.. (getContentPane) (add (make-jpanel view))) 1.14 (.pack))) 1.15 1.16 +(defn ^JFrame show-view! 1.17 + ([view] 1.18 + (show-view! "Indyvon" view)) 1.19 + ([title view] 1.20 + (let [f (atom nil)] 1.21 + (EventQueue/invokeAndWait 1.22 + #(doto (reset! f (make-jframe title view)) 1.23 + (.setDefaultCloseOperation javax.swing.JFrame/DISPOSE_ON_CLOSE) 1.24 + (.setVisible true))) 1.25 + @f))) 1.26 + 1.27 (defn message [m] 1.28 (JOptionPane/showMessageDialog (:component *scene*) m))