Skip to content

Instantly share code, notes, and snippets.

@raek raek/gist:877894
Created Mar 19, 2011

What would you like to do?
(defn prepare-renderer [this list item _ selected _]
(let [[bg fg] (if selected
[#(.getSelectionBackground %)
#(.getSelectionForeground %)]
[#(.getBackground %)
#(.getForeground %)])]
(.setBackground this (bg list))
(.setForeground this (fg list)))
(let [[item-type display-string _ _ _] item]
(.setIcon this (-> item-type item-type-names icons))
(.setFont this monospace-font)
(.setText this display-string))
(defn init-renderer [this]
(.setOpaque this true))
(def list-cell-renderer
(doto (-> (get-proxy-class JLabel ListCellRenderer)
(init-proxy {"getListCellRendererComponent" #'prepare-renderer})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.