Java Q&A
by Cameron Laird

Example 1:
package require java
java::import AirPurifier
pack [button .b -text "Start purifier" -command action]
pack [label .l]
proc action {} {
    switch [.b cget -text] {
        "Start purifier" {
           set ::purifier [java::new AirPurifier]
           .b configure -text "Emit pulse"
           set label "Purifier started."
        }
        "Emit pulse" {
           ::purifier standard
           set label "Pulse emitted."
        }
        default {
           set label ""
        }
    }
    .l configure -text $label
}


Example 2:
(a)
jar $jar_filename

(b)
java::field $my_dialogue okButton

(c)
java::info fields $some_object


Example 3:

test javaInterp-10.4 {Java_tcl_lang_Interp_getVar} {
   catch {unset foo}
   set foo(bar) baz
   set i [java::getinterp]
   [$i {getVar java.lang.String int} foo(bar) 0] toString
} {baz}






1

