Skip to content

Instantly share code, notes, and snippets.

@maxweber
Created August 29, 2011 07:34
Show Gist options
  • Save maxweber/1177947 to your computer and use it in GitHub Desktop.
Save maxweber/1177947 to your computer and use it in GitHub Desktop.
Vijual Swing example
(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