|
ToDo:
|
呑み過ぎたー
core.clj
(ns swingsample.core
(:gen-class)
(:require [swingsample.sample :as sample]))
(defn -main[& args]
(sample/show))
んでもってかーんたんなサンプル
(ns swingsample.sample
(:import [javax.swing JFrame JButton JPanel JOptionPane JLabel]
[java.awt.event ActionListener]
[java.awt Container BorderLayout]))
(defn show[]
(let [frame (JFrame. "Title")
button (JButton. "Push me")
panel (JPanel.)]
(.setBounds frame 100 100 500 500)
(.setDefaultCloseOperation frame JFrame/EXIT_ON_CLOSE)
(.add panel button)
(.addActionListener button
(reify ActionListener
(actionPerformed [this e]
(let [label (JLabel. "Pushed")]
(JOptionPane/showMessageDialog frame label)))))
(.. frame getContentPane (add panel BorderLayout/CENTER))
(.setVisible frame true)))