BBjDrawPanel::setPenColor

Description

In BBj 16.0 and higher, this method sets the pen color for lines and outlines of objects drawn on the BBjDrawPanel.

Syntax

Return Value

Method

void

setPenColor(BBjColor color)

Parameters

Variable

Description

color

Color for lines, arrows, and outlines.

Return Value

None.

Remarks

None.

Example

rem ' BBjDrawPanel::setPenColor

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
x = 50, y = 50, w = 400, h = 250
title$ = "BBjDrawPanel::setPenColor"
window! = sysgui!.addWindow(x,y,w,h,title$,$00090883$,$$)
window!.setCallback(window!.ON_CLOSE,"eoj")
window!.setTrack(0)
menu! = window!.addMenuBar()
file! = menu!.addMenu(100,"&File")
wipe! = file!.addMenuItem(101,"&New")
wipe!.setCallback(wipe!.ON_MENU_ITEM_SELECT,"wipe")
save! = file!.addMenuItem(102,"Save &As...")
save!.setCallback(wipe!.ON_MENU_ITEM_SELECT,"save")
exit! = file!.addMenuItem(199,"E&xit")
exit!.setCallback(exit!.ON_MENU_ITEM_SELECT,"eoj")
pen! = menu!.addMenu(200,"&Pen")
black! = pen!.addMenuItem(201,"Blac&k")
black!.setCallback(black!.ON_MENU_ITEM_SELECT,"black")
blue! = pen!.addMenuItem(202,"&Blue")
blue!.setCallback(black!.ON_MENU_ITEM_SELECT,"blue")
red! = pen!.addMenuItem(203,"&Red")
red!.setCallback(red!.ON_MENU_ITEM_SELECT,"red")
magenta! = pen!.addMenuItem(204,"&Magenta")
magenta!.setCallback(magenta!.ON_MENU_ITEM_SELECT,"magenta")
green! = pen!.addMenuItem(205,"&Green")
green!.setCallback(green!.ON_MENU_ITEM_SELECT,"green")
random! = pen!.addMenuItem(206,"Ra&ndom")
random!.setCallback(random!.ON_MENU_ITEM_SELECT,"random")
drawpanel! = window!.getDrawPanel()
drawpanel!.setScribble(1)
color! = sysgui!.makeColor(255,255,240)
drawpanel!.clearDrawing(color!)
drawpanel!.setPenWidth(3)
format$ = "png"
process_events

eoj:
release

wipe:
    drawpanel!.clearDrawing()
return

black:
    drawpanel!.setPenColor(BBjColor.BLACK)
    print "BBjDrawPanel::getPenColor: ",
    print drawpanel!.getPenColor()
return

blue:
    drawpanel!.setPenColor(BBjColor.BLUE)
    print "BBjDrawPanel::getPenColor: ",
    print drawpanel!.getPenColor()
return

red:
    drawpanel!.setPenColor(BBjColor.RED)
    print "BBjDrawPanel::getPenColor: ",
    print drawpanel!.getPenColor()
return

magenta:
    drawpanel!.setPenColor(BBjColor.MAGENTA)
    print "BBjDrawPanel::getPenColor: ",
    print drawpanel!.getPenColor()
return

green:
    drawpanel!.setPenColor(BBjColor.GREEN)
    print "BBjDrawPanel::getPenColor: ",
    print drawpanel!.getPenColor()
return

random:
    color! = sysgui!.makeColor(rnd(255),rnd(255),rnd(255))
    drawpanel!.setPenColor(color!)
    print "BBjDrawPanel::getPenColor: ",
    print drawpanel!.getPenColor()
return

save:
    file$ = "Signature."+format$
    file$ = filesave("Save Signature",dsk("")+dir(""),file$,"")
    if pos("::"=file$) then return
    file! = new java.io.File(file$)
    file$ = file!.getCanonicalPath()
    path! = file!.getCanonicalPath().toLowerCase()
    if path!.endsWith(".gif") then format$ = "gif"
    if path!.endsWith(".png") then format$ = "png"
    if path!.endsWith(".jpg") then format$ = "jpg"
    if path!.endsWith(".jpeg") then format$ = "jpeg"
    image! = window!.getDrawPanelImage()
    image$ = image!.getBytes(format$,err = failed)
    image = unt
    open (image,mode="O_CREATE,O_TRUNC")file$
    writerecord (image)image$
    close (image)
    i = msgbox(file$,0,"Signature image file created")
return

failed:
    i = msgbox(errmes(-1),16,"Signature image file failed")
return

See Also

BBjAPI

BBjSysGui

BBjWindow

BBjDrawPanel

PENCOLOR Mnemonic - Set SYSGUI Pen Color

BBjDrawPanel::getPenColor()

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.