SmalltalkAppletContext.st
author Claus Gittinger <cg@exept.de>
Thu, 24 Nov 2011 12:54:59 +0100
changeset 2305 c11e70f81f74
parent 2254 49cb49af9626
child 2353 fa7400d022a0
permissions -rw-r--r--
fixed: #version_SVN ($ to §)

"
 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.
"
"{ Package: 'stx:libjava' }"

Object subclass:#SmalltalkAppletContext
	instanceVariableNames:'statusHolder'
	classVariableNames:''
	poolDictionaries:''
	category:'Languages-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: /cvs/stx/stx/libjava/SmalltalkAppletContext.st,v 1.11 2011-11-24 11:51:42 cg Exp $'
!

version_SVN
    ^ '§Id: SmalltalkAppletContext.st,v 1.10 2011/08/18 18:42:48 vrany Exp §'
! !