1.2.0 permalink Arrow_down_16x16
  • (open-url-in-swing url)
Opens url (a string) in a Swing window.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/javadoc/browse_ui.clj:15 top

(defn open-url-in-swing
  "Opens url (a string) in a Swing window."
  (let [htmlpane (javax.swing.JEditorPane. url)]
    (.setEditable htmlpane false)
    (.addHyperlinkListener htmlpane
      (proxy [javax.swing.event.HyperlinkListener] []
        (hyperlinkUpdate [^javax.swing.event.HyperlinkEvent e]
          (when (= (.getEventType e) (. javax.swing.event.HyperlinkEvent$EventType ACTIVATED))
            (if (instance? javax.swing.text.html.HTMLFrameHyperlinkEvent e)
              (-> htmlpane .getDocument (.processHTMLFrameHyperlinkEvent e))
              (.setPage htmlpane (.getURL e)))))))
    (doto (javax.swing.JFrame.)
      (.setContentPane (javax.swing.JScrollPane. htmlpane))
      (.setBounds 32 32 700 900)
Vars in clojure.contrib.javadoc.browse-ui/open-url-in-swing: -> = defn doto instance? let proxy when
Used in 1 other vars open-url-in-swing

Comments top

No comments for open-url-in-swing. Log in to add a comment.