*** empty log message ***
authorcg
Mon, 11 Dec 2000 16:24:28 +0000
changeset 693 2beae7b13cdb
parent 692 2d757af88e5b
child 694 e76b0c9144c0
*** empty log message ***
JavaClass.st
JavaEmbeddedFrameView.st
JavaMethod.st
--- a/JavaClass.st	Fri Dec 01 10:15:32 2000 +0000
+++ b/JavaClass.st	Mon Dec 11 16:24:28 2000 +0000
@@ -851,16 +851,11 @@
         ^ true
     ].
 
-"/ NEEDS startApplet to work ...
-"/    "/ if I inherit from Applet, I am 
-"/
-"/    (self isSubclassOf:(Java at:'java.applet.Applet')) ifTrue:[
-"/        ^ true.
-"/    ].
+    (self isSubclassOf:(Java at:'java.applet.Applet')) ifTrue:[
+        ^ true.
+    ].
 
     ^ false
-
-    "Modified: / 3.11.1998 / 23:04:59 / cg"
 !
 
 open
@@ -958,8 +953,66 @@
 !JavaClass methodsFor:'executing programs'!
 
 startApplet
-    |f me stub|
+    |f me stub top appFrame|
+
+    top := StandardSystemView new.
+    appFrame := JavaEmbeddedFrameView new.
+    appFrame origin:0.0@0.0 corner:1.0@1.0.
+    top addSubView:appFrame.
+
+    appFrame appletIsPreloaded:true.
+    appFrame codeURL:'file:/dummy'.
+    appFrame codeBaseURL:'file:/dummy'.
+    appFrame autoSetupApplet:true.
+    appFrame autoStartApplet:true.
+    appFrame autoDestroyApplet:true.
+
+
+    top open.
+    ^ self.
+
+    "/ TODO: setup embeddedAppletFrame correctly
+    "/ (for getParameter to work ...)
+
+    "/ create a frame and wrap me;
+    "/ as in:
 
+"/    public static void main(String args[]) {
+"/        Frame f = new Frame("myName");
+"/        mySelf me = new mySelf();
+"/
+"/        me.init();
+"/        me.start();
+"/
+"/        f.add("Center", me);
+"/        f.setSize(300, 300);
+"/        f.show();
+"/    }
+    f := (Java at:'java.awt.Frame') basicNew.
+    f perform:#'<init>(Ljava/lang/String;)V' with:(Java as_String:self name).
+self halt.
+    me := self basicNew.
+    me perform:#'<init>()V'.
+self halt.
+
+    stub := (Java at:'netscape.applet.EmbeddedAppletFrame') new.
+    me instVarNamed:'stub' put:stub.
+self halt.
+
+    me perform:#'init()V'.
+    me perform:#'start()V'.
+self halt.
+
+    f perform:#'add(Ljava/lang/String;Ljava/awt/Component;)Ljava/awt/Component;' 
+         with:(Java as_String:'Center')
+         with:me.
+self halt.
+    f perform:#'setSize(II)V' with:300 with:300.
+self halt.
+    f perform:#'show()V'.
+self halt.
+
+    "Modified: / 3.11.1998 / 23:04:41 / cg"
     "/ TODO: setup embeddedAppletFrame correctly
     "/ (for getParameter to work ...)
 
@@ -1794,6 +1847,6 @@
 !JavaClass class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaClass.st,v 1.118 2000/09/21 11:40:55 cg Exp $'
+    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaClass.st,v 1.119 2000/12/11 16:24:28 cg Exp $'
 ! !
 JavaClass initialize!
--- a/JavaEmbeddedFrameView.st	Fri Dec 01 10:15:32 2000 +0000
+++ b/JavaEmbeddedFrameView.st	Mon Dec 11 16:24:28 2000 +0000
@@ -17,7 +17,7 @@
 	instanceVariableNames:'codeURL codeBaseURL documentURL archiveURL parameterDictionary
 		embeddedAppletFrame applet appletID appletThread
 		infoDisplayReceiver autoSetupApplet autoStartApplet
-		autoDestroyApplet isNS40 attributeHashTable'
+		autoDestroyApplet isNS40 attributeHashTable appletIsPreloaded'
 	classVariableNames:'NextSequentialAppletID'
 	poolDictionaries:''
 	category:'Java-Views-Support'
@@ -94,6 +94,10 @@
     "Created: / 28.1.1998 / 21:08:54 / cg"
 !
 
+appletIsPreloaded:aBoolean
+    appletIsPreloaded := aBoolean.
+!
+
 appletThread
     ^ appletThread
 
@@ -340,7 +344,7 @@
     do:[
         self startAppletThread.
 
-        self appletLOAD.
+        appletIsPreloaded ifFalse:[self appletLOAD].
         self appletINIT.
     ].
 
@@ -449,6 +453,7 @@
 !
 
 initialize           
+    appletIsPreloaded := false.
     super initialize.
     viewBackground := Color black.
 
@@ -648,5 +653,5 @@
 !JavaEmbeddedFrameView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaEmbeddedFrameView.st,v 1.22 2000/09/06 18:33:50 cg Exp $'
+    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaEmbeddedFrameView.st,v 1.23 2000/12/11 16:23:56 cg Exp $'
 ! !
--- a/JavaMethod.st	Fri Dec 01 10:15:32 2000 +0000
+++ b/JavaMethod.st	Mon Dec 11 16:24:28 2000 +0000
@@ -1676,6 +1676,41 @@
     "Modified: / 14.1.1998 / 13:30:54 / cg"
 !
 
+messagesSent
+    "return a collection of messages sent by this method"
+
+    |walker any selectors|
+
+    "/ sigh - must extract all accessed literals ...
+    "/ must deparse the byteCode in order to do this.
+
+    selectors := IdentitySet new.
+    walker := JavaByteCodeEnumerator new.
+    walker 
+        literalAction:
+            [:pc :slotIndex :const |
+                |mSel|
+
+                (const isNumber 
+                or:[const isString
+                or:[const isNil]]) ifFalse:[
+                    const isJavaMethod ifTrue:[
+                        mSel := const selector.
+                    ] ifFalse:[
+                        const isJavaMethodRef ifTrue:[
+                            mSel := const selector "/ signature.
+                        ]
+                    ].
+                ].
+                mSel notNil ifTrue:[
+                    "/ Transcript showCR:mSel.
+                    selectors add:mSel
+                ].
+            ].
+    walker decompile:self to:nil.
+    ^ selectors
+!
+
 package
     "in java, class extensions are not possible;
      all methods MUST be in their classes package"
@@ -1864,6 +1899,6 @@
 !JavaMethod class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaMethod.st,v 1.98 2000/12/01 10:15:32 cg Exp $'
+    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaMethod.st,v 1.99 2000/12/11 16:23:31 cg Exp $'
 ! !
 JavaMethod initialize!