Created
August 29, 2011 07:34
-
-
Save maxweber/1177947 to your computer and use it in GitHub Desktop.
Vijual Swing example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns prototype.graph | |
(:use vijual) | |
(:import [javax.swing JFrame JLabel] | |
java.awt.image.BufferedImage | |
java.awt.Dimension)) | |
(defn draw [] | |
(let [frame (new JFrame) | |
image (draw-tree-image [[:north-america [:usa [:miami] [:seattle] [:idaho [:boise]]]] [:europe [:germany] [:france [:paris] [:lyon] [:cannes]]]]) | |
canvas (proxy [JLabel] [] (paint [g] (.drawImage g image 0 0 this))) | |
graphics (.createGraphics image)] | |
(.add frame canvas) | |
(.setSize frame (new Dimension 600 600)) | |
(.show frame))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment