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
import java.awt.BorderLayout; | |
import java.awt.event.MouseAdapter; | |
import java.awt.event.MouseEvent; | |
import javax.swing.JButton; | |
import javax.swing.JFrame; | |
import javax.swing.JPanel; | |
public class VisibleButton { |
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
(frame :resizable? true | |
:content (vertical-panel | |
:id :panel | |
:items | |
[(button :text "show button 2" | |
:listen [:action (fn [e] | |
(let [btn (select (to-frame e) [:#btn])] | |
(.setVisible btn true)))]) | |
(doto (button :id :btn :text "here I am") (.setVisible false))])) |
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
import java.awt.event.ComponentAdapter; | |
import java.awt.event.ComponentEvent; | |
import java.awt.event.HierarchyEvent; | |
import java.awt.event.HierarchyListener; | |
import javax.swing.JFrame; | |
import javax.swing.JLabel; | |
import javax.swing.JSplitPane; |
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
Namespaces | |
seesaw.test.event | |
#'seesaw.event/unappend-listener | |
can remove a listener | |
#'seesaw.event/listen | |
can install a mouse-clicked listener | |
returns a function that will remove the installed listener | |
can install two mouse-clicked listeners | |
can install a document listener | |
can register for a class of events |
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
(defn heavy-scrollable [target] | |
(doto (java.awt.ScrollPanel.) | |
(.add target))) | |
(show! (frame :content (heavy-scrollable (... make a PApplet)))) |
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
(ns pi.core | |
(:use seesaw.core)) | |
(native!) | |
(def gap [:fill-h 5]) | |
; Set up the structure of the ui, giving widgets classes and ids as needed. | |
(defn make-frame [] | |
(frame |
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
(ns hugo.views.main-view | |
(:use hugo.db.sqlite) | |
(:use [seesaw core color])) | |
(defn create-home-view [data] | |
(show! | |
(frame | |
:title "@rippinrobr's Hugo Best Novel Database" | |
:on-close :exit | |
:size [500 :by 600] |
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
(ns seesaw.async | |
(:use [seesaw core])) | |
; see http://dotnetslackers.com/articles/net/Programming-user-interfaces-using-f-sharp-workflows.aspx#1478 | |
(defmacro async | |
"Macro that executes an async call (the first form), ignores its result, and the | |
executes the body normally." | |
[async-call & body] | |
`(~@(apply list (first async-call) `(fn [& args#] ~@body) (rest async-call)))) |
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
(defprotocol Async | |
(run-async* [this continue]) | |
(cancel-async* [this])) | |
(defn await-event | |
"Awaits the given event on the given target asynchronuously. Passes on the | |
event to the continuation." | |
[target event] | |
(let [remove-fn (promise)] | |
(reify Async |
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
# Emulating CSoar's cmd function in JSoar | |
# Install a fake "cmd" RHS function. | |
script javascript { | |
soar.rhsFunction({ | |
name: "cmd", | |
execute: function(context, args) { | |
var cmd = ""; | |
for(var i = 0; i < args.length; i++) { | |
cmd = cmd + args[i] + " "; |
OlderNewer