This repository has been archived by the owner on Nov 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Swing: Added custom adders support and example. For #1
- Loading branch information
Showing
3 changed files
with
46 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
(ns guiftw.examples.swing.custom-adders | ||
(:gen-class) | ||
(:use (guiftw swing styles)) | ||
(:import (javax.swing JFrame JButton JLabel | ||
JTabbedPane JScrollPane | ||
JSplitPane))) | ||
|
||
(def window | ||
(swing [JFrame [:*id :main-window | ||
:title "Custom Adders Demo" | ||
:size ^unroll (500 400) | ||
:visible true] | ||
[JSplitPane [:resize-weight 0.5] | ||
[JTabbedPane [:*lay JSplitPane/LEFT | ||
:*adder (fn [parent parent-style child child-style] | ||
(.addTab parent | ||
(-> child-style :specials :*tab-title) | ||
child))] | ||
[JButton [:*tab-title "Tab title FTW!" | ||
:text "This is a button."]] | ||
[JLabel [:*tab-title "Second TAB" | ||
:text "YEAH!"]]] | ||
[JScrollPane [:*lay JSplitPane/RIGHT | ||
:*adder (fn [parent parent-style child child-style] | ||
(.setViewportView parent child))] | ||
[JLabel [:text (str "<html><pre>" | ||
(->> "Veeeeeeeery Looooooong Teeeeext" | ||
(interleave (repeat "\n ")) | ||
(reduce str)) | ||
"</pre></html>")]]]]])) | ||
|
||
(defn -main [& args] | ||
(-> @(window) :root .validate)) |
This file contains 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