Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Tramp 1.2.0 #1

Open
wants to merge 7 commits into from

2 participants

Franz Haas Stuart Halloway
Franz Haas

Three improvements:

comlex numbers now can be rounded just like other numbers
a swing message box wrapper
a add-mouse-clicked-listener in the same style as add-key-typed-listener

Kind regards
Franz Haas

Franz Haas

This might be a cute extension to the complex-numbers to make them feel more like normal numbers...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
6 pom.xml
View
@@ -4,13 +4,13 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<properties>
- <clojure.version>1.2.0-master-SNAPSHOT</clojure.version>
+ <clojure.version>1.2.0-beta1</clojure.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<modelVersion>4.0.0</modelVersion>
<groupId>org.clojure</groupId>
<artifactId>clojure-contrib</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.0-beta1</version>
<url>http://clojure.org/</url>
<description>Clojure user contributions library.</description>
<name>${artifactId}</name>
@@ -41,7 +41,7 @@
</repository>
<repository>
<id>clojure-releases</id>
- <url>http://build.clojure.org/snapshots</url>
+ <url>http://build.clojure.org/releases</url>
<releases>
<enabled>true</enabled>
</releases>
6 src/main/clojure/clojure/contrib/complex_numbers.clj
View
@@ -291,3 +291,9 @@
[x]
(let [i (imag x)]
(complex (gm/cos i) (gm/sin i))))
+
+;Franz Haas
+(defmethod gm/round ::complex
+ [x]
+ (let [[r i] (vals x)]
+ (complex (gm/round r) (gm/round i))))
25 src/main/clojure/clojure/contrib/swing_utils.clj
View
@@ -14,7 +14,7 @@
;; Created 31 May 2009
(ns clojure.contrib.swing-utils
- (:import (java.awt.event ActionListener KeyAdapter)
+ (:import (java.awt.event ActionListener KeyAdapter MouseListener)
(javax.swing AbstractAction Action
JMenu JMenuBar JMenuItem
SwingUtilities))
@@ -41,6 +41,23 @@
listener))
;; ----------------------------------------------------------------------
+;; Franz Haas
+
+(defn add-mouse-clicked-listener
+ "Adds a MouseListener, only setting the clicked interface When a key
+ is typed, f is invoked with the MouseEvent as its first argument
+ followed by args. Returns the listener."
+ [component f & args]
+ (let [listener (proxy [MouseListener] []
+ (mouseEntered [e])
+ (mouseExited [e])
+ (mousePressed [e])
+ (mouseReleased [e])
+ (mouseClicked [event] (apply f event args)))]
+ (.addMouseListener component listener)
+ listener))
+
+;; ----------------------------------------------------------------------
;; Meikel Brandmeyer
(defn do-swing*
@@ -150,3 +167,9 @@
menubar))
;; ----------------------------------------------------------------------
+;; Franz Haas
+
+(defn message-box
+ "shows a message box and return imediately"
+ [text]
+ (do-swing (javax.swing.JOptionPane/showMessageDialog nil text)))
Something went wrong with that request. Please try again.