SmalltalkAppletContext.st
author cg
Fri, 29 Jan 1999 15:30:31 +0000
changeset 545 6a841644c5e9
parent 419 679a4b82b3bb
child 713 75e92ac63bf1
permissions -rw-r--r--
checkin from browser

"
 COPYRIGHT (c) 1997 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"




Object subclass:#SmalltalkAppletContext
	instanceVariableNames:'statusHolder'
	classVariableNames:''
	poolDictionaries:''
	category:'Java-Views-Support'
!

!SmalltalkAppletContext class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1997 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"



!

documentation
"
    [Author:]
        Claus Gittinger
"


! !

!SmalltalkAppletContext methodsFor:'accessing'!

getImage:url
    |imgSource toolKit|

    "return 
        Toolkit.getDefaultToolkit().createImage(new sun.awt.image.URLImageSource(arg1)))"

    imgSource := (Java classForName:'sun.awt.image.URLImageSource') newCleared.
    imgSource perform:#'<init>(Ljava/net/URL;)V' with:url.

    toolKit := (Java classForName:'java.awt.Toolkit') perform:#getDefaultToolkit.
    ^ toolKit perform:#createImage with:imgSource.

    "Modified: / 4.11.1998 / 21:07:48 / cg"
!

showStatus:arg
    |msg|

    arg isJavaObject ifTrue:[
        (arg isMemberOf:(Java classForName:'java.lang.String')) ifTrue:[
            msg := Java as_ST_String:arg
        ] ifFalse:[
            msg := arg printString
        ]
    ] ifFalse:[
        msg := arg
    ].

    statusHolder notNil ifTrue:[
        statusHolder value:msg
    ] ifFalse:[
        Transcript showCR:msg
    ].
    ^ nil

    "Created: 1.8.1997 / 15:48:53 / cg"
    "Modified: 8.8.1997 / 12:07:43 / cg"
! !

!SmalltalkAppletContext methodsFor:'java accessing'!

doesNotUnderstand:aMessage
    |selector img|

    (selector := aMessage selector) == #'showStatus(Ljava/lang/String;)V' ifTrue:[
        self showStatus:(Java as_ST_String:(aMessage arguments at:1)).
        ^ self
    ].
    selector == #'getImage(Ljava/net/URL;)Ljava/awt/Image;' ifTrue:[
        ^ self getImage:(aMessage arguments at:1).
    ].
    ^ super doesNotUnderstand:aMessage

    "Created: / 12.1.1998 / 23:48:10 / cg"
    "Modified: / 12.1.1998 / 23:53:31 / cg"
! !

!SmalltalkAppletContext class methodsFor:'documentation'!

version
    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/SmalltalkAppletContext.st,v 1.8 1999/01/29 15:30:31 cg Exp $'
! !