Created
December 24, 2019 06:15
-
-
Save ryoakg/a933c7a822998e479e1d7fcc96d99b8e to your computer and use it in GitHub Desktop.
GRIDの大きさは全部同じみたい
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
| (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