Skip to content

Instantly share code, notes, and snippets.

@ryoakg
Created December 24, 2019 06:15
Show Gist options
  • Select an option

  • Save ryoakg/a933c7a822998e479e1d7fcc96d99b8e to your computer and use it in GitHub Desktop.

Select an option

Save ryoakg/a933c7a822998e479e1d7fcc96d99b8e to your computer and use it in GitHub Desktop.
GRIDの大きさは全部同じみたい
(import (javax.swing JFrame JLabel)
(java.awt GridLayout))
(defn- rand-str [len]
(apply str (take len (repeatedly #(char (+ (rand 26) 65))))))
(let [n-rows 10
n-cols 3
frame (doto (JFrame. "GRIDの大きさは全部同じみたい")
(.setDefaultCloseOperation JFrame/DISPOSE_ON_CLOSE))]
(.setLayout (.getContentPane frame) (GridLayout. n-rows n-cols))
(dotimes [_ (* n-rows n-cols)]
(.add (.getContentPane frame) (JLabel. (rand-str (rand-int 30)))))
(doto frame
.pack
(.setVisible true)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment