
BBjButton::setImageSize
Description
In BBj 15.0 and higher, this BBjButton method sets the size of the button image.
Syntax
Return Value |
Method |
---|---|
void |
setImageSize(int width, int height) |
Parameters
Variable |
Description |
---|---|
width |
Specifies the image width. |
height |
Specifies the image height. |
Return Value
None.
Example
Copy
BBjButton::setImageSize Example
REM ' BBjButton::setImageSize
image$ = "https://basis.cloud/sites/basis.com/files/amity_island_logo.jpg"
PRINT "Image: ",image$
sysgui = UNT
OPEN (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
imagemanager! = sysgui!.getImageManager()
image! = javax.imageio.ImageIO.read(new java.net.URL(image$))
os! = new java.io.ByteArrayOutputStream()
javax.imageio.ImageIO.write(image!,"jpg",os!)
bytes! = os!.toByteArray()
image! = imagemanager!.loadImageFromBytes(bytes!)
PRINT "Image width:",image!.getWidth()
PRINT "Image height:",image!.getHeight()
window! = sysgui!.addWindow(100,100,250,225,"setImageSize",$00090003$)
window!.setCallback(window!.ON_CLOSE,"eoj")
unscaled! = window!.addButton(101,25,25,200,100,"",$$)
unscaled!.setImage(image!)
scaled! = window!.addButton(102,25,150,200,50,"Scaled Image",$$)
scaled!.setImage(image!)
scaled!.setImageSize(image!.getWidth()/2,image!.getHeight()/2)
PROCESS_EVENTS
eoj:
RELEASE
See Also
See the BBj Object Diagram for an illustration of the relationship between BBj Objects.