SmalltalkAppletContext.st
author Claus Gittinger <cg@exept.de>
Fri, 22 Nov 2002 21:14:07 +0100
changeset 2108 ca8c4e7db2e8
parent 749 e898eaeff091
child 2151 c0b6570c6f9b
permissions -rw-r--r--
category change

"
 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.9 2002-11-22 20:13:53 cg Exp $'
! !