Professor Lee pointed out that it is difficult to access the
fields of a parent class from within Tcl Blend

I'm a little tired, but it seems like it should be possible to access
all the fields in a derived class with out resorting to java::cast

The example below is from Tcl Blend 1.1 with JDK1.1.6 under Solaris2.5.1

cxh@carson 11% cat Foo.java
cxh@carson: Command not found
cxh@carson 12% cat Foo.java 
public class Foo {
    public double afield;
}
cxh@carson 13% cat Bar.java
public class Bar extends Foo {
}
cxh@carson 14% javac Foo.java Bar.java
cxh@carson 15% tclsh
% package require java
1.1
% set java::jdkVersion
1.1.6
% set bar [java::new Bar] 
java0x1
% java::info fields $bar
afield
% java::field $bar afield
field "afield" doesn't exist
% java::field [java::cast Foo $bar] afield
0.0
%

Is there an easier way to access the afield field? 

-Christopher

----------------------------------------------------------------
The TclJava mailing list is sponsored by WebNet Technologies.
To subscribe:    send mail to [EMAIL PROTECTED]  
                 with the word SUBSCRIBE as the subject.
To unsubscribe:  send mail to [EMAIL PROTECTED] 
                 with the word UNSUBSCRIBE as the subject.
To send to the list, send email to '[EMAIL PROTECTED]'. 
A list archive is at: http://www.findmail.com/listsaver/tcldallas/

Reply via email to