Skip to content

Instantly share code, notes, and snippets.

(defn create-converters-panel
"Creates panel containing the labels and text fields."
[]
(let [
create-an-inner-panel (fn [] (JPanel. (GridLayout. 0 1 5 5)))
label-panel (create-an-inner-panel)
text-field-panel (create-an-inner-panel)
outer-panel (JPanel. (BorderLayout.))]
(import '(java.awt BorderLayout GridLayout Toolkit)
'(javax.swing AbstractAction Action BorderFactory JFrame JPanel JButton
JMenu JMenuBar JTextField JLabel))
(defn f2c
"Converts a Fahrenheit temperature value to Celsius."
[f]
(/ (* 5.0 (- f 32.0)) 9.0))
# Bidirectional Hash
class BiHash
def initialize(a_hash)
raise Exception.new if a_hash == nil
@l2r = {}
(defn create-simple-document-listener
"Returns a DocumentListener that performs the specified behavior
identically regardless of type of document change."
[behavior]
(proxy [DocumentListener][]
(changedUpdate [event] (behavior event))
(insertUpdate [event] (behavior event))
(removeUpdate [event] (behavior event))))
(defn create-simple-document-listener
"Returns a DocumentListener that performs the specified behavior
identically regardless of type of document change."
[behavior]
(proxy [DocumentListener][]
(changedUpdate [event] (behavior event))
(insertUpdate [event] (behavior event))
(removeUpdate [event] (behavior event))))
/**
* Shows a little about Object.clone()'s behavior.
*
* Object.clone() is a native method, so I couldn't look at the source code.
* I believe what it does is to copy object references. That means that
* if you don't override it, all clones will be pointing to the same
* instances of the contained members.
*/
public class CloneTest {
/**
* Shows a little about Object.clone()'s behavior.
*
* Object.clone() is a native method, so I couldn't look at the source code.
* I believe what it does is to copy object references. That means that
* if you don't override it, all clones will be pointing to the same
* instances of the contained members.
*/
public class CloneTestA {
/**
* Shows a little about Object.clone()'s behavior.
*
* Object.clone() is a native method, so I couldn't look at the source code.
* I believe what it does is to copy object references. That means that
* if you don't override it, all clones will be pointing to the same
* instances of the contained members.
*/
public class CloneTestB {
public String getObject()
{
String result;
if (TO_ESCAPED_UNICODE.equals(translationType))
{
result = Strings.toEscapedUnicode(source);
}
else
{
result = Strings.fromEscapedUnicode(source);
package com.fedcsc.asr.web.wicket;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.Component;
import org.apache.wicket.util.tester.WicketTester;
import java.util.List;
import java.util.ArrayList;
/**