BBjDrawPanel

Description

In BBj 16.0 and higher, the BBjDrawPanel is the drawing surface associated with a BBjWindow.

Creation

BBjAPI > BBjSysGui > BBjWindow > BBjDrawPanel

A BBjDrawPanel is created through the following BBjWindow method:

Return Value

Method

BBjDrawPanel

getDrawPanel()

Methods of BBjDrawPanel

Return Value

Method

void

clearDrawing()

void

clearDrawing(BBjColor color)

void

drawArc(number x, number y, int r, double aspect, double startAngle, double endAngle, boolean pieFlag)

void

drawArrow(number x, number y, boolean head, boolean tail)

void

drawEllipse(number x, number y, number width, int height)

void

drawImage(BBjImageimage, int x1, int y1, int x2, int y2)

void

drawLine(int x1, int y1, int x2, int y2)

void

drawLineTo(number x, int y)

void

drawPoint(number x, int y)

void

drawPolygon(java.util.List list)

void

drawPolyline(java.util.List list)

void

drawRect(number x, number y, number width, int height)

void

drawText(number x, number y, string text)

BBjImage

getDrawPanelImage()

BBjColor

getFillColor()

int

getFillType()

BBjFont getFont()

int

getPattern()

BBjColor

getPenColor()

int

getPenWidth()

BBjColor

getTextColor()

boolean

getTrack()

void

moveTo(number x, int y)

void

pop()

void

push()

void

setBackColor(BBjColor color)

void

setDrawMode(int mode)

void

setDrawUnits(int units)

void

setEnableRepaint(boolean enable)

void

setFillColor(BBjColor color)

void

setFillType(int fillType)

void setFont(BBjFont font!)

void

setOpaque(int style)

void

setPattern(int pattern)

void

setPenColor(BBjColor  color)

void

setPenWidth(int width)

void

setRound(number x, int y)

void

setScribble(boolean scribble)

void

setTextColor(BBjColor color)

Remarks

Prior to BBj 16.0, BBjDrawPanel functionality was only available using the drawing mnemonics. The corresponding mnemonics, if any, are noted in the See Also section of each method.

Example

rem ' BBjDrawPanel

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
title$ = "BBjDrawPanel"
window! = sysgui!.addWindow(25,25,1200,750,title$,$00090003$)
window!.setCallback(window!.ON_CLOSE,"eoj")
window!.setTrack(0)
window!.setFont(sysgui!.makeFont("Arial",8,0))
drawpanel! = window!.getDrawPanel()
drawpanel!.setPenColor(BBjColor.BLUE)
drawpanel!.setFillColor(BBjColor.GREEN)
drawpanel!.setTextColor(BBjColor.BLUE)
drawpanel!.setRound(5,5)
drawpanel!.drawText(10,25,"Shape")
drawpanel!.drawText(10,55,"drawPoint")
drawpanel!.drawText(10,100,"drawRect")
drawpanel!.drawText(10,175,"drawArc")
drawpanel!.drawText(10,225,"drawArc")
drawpanel!.drawText(10,325,"drawEllipse")
drawpanel!.drawText(10,400,"drawArrow")
drawpanel!.drawText(10,450,"drawArrow")
drawpanel!.drawText(10,500,"drawLine")
drawpanel!.drawText(10,575,"drawPolygon")
drawpanel!.drawText(10,675,"drawPolyline")
for i = 0 to 10
    x = i * 100 + 25
    drawpanel!.setFillType(i)
    drawpanel!.setPattern(i)
    drawpanel!.setPenWidth((i+1)*0.25)
    drawpanel!.drawPoint(x+100,50)
    drawpanel!.drawText(x+85,25,"setFillType("+str(i)+")")
    drawpanel!.drawRect(x+75,75,75,50)
    r1 = i * Math.PI / 2
    r2 = r1 + Math.PI / 2
    drawpanel!.drawArc(x+100,175,25,1,r1,r2,1)
    drawpanel!.drawArc(x+100,225,25,1,r1,r2,0)
    drawpanel!.drawEllipse(x+75,275,75,50)
    adj = (i-5) * 5
    drawpanel!.moveTo(x+75,400)
    drawpanel!.drawArrow(x+150,400+adj,0,1)
    drawpanel!.moveTo(x+75,450)
    drawpanel!.drawArrow(x+150,450+adj,1,0)
    drawpanel!.drawLine(x+75,500,x+150,525)
    points = i + 3
    list! = bbjapi().makeVector()
    for point = 0 to points-1
        angle = point * 2 * Math.PI / points
        px = int(40 * cos(angle) + 110 + x)
        py = int(40 * sin(angle) + 600)
        list!.add(px)
        list!.add(py)
    next point
    drawpanel!.drawPolygon(list!)
    list! = bbjapi().makeVector()
    for point = 0 to points-1
        angle = point * 2 * Math.PI / points
        px = int(40 * cos(angle) + 110 + x)
        py = int(40 * sin(angle) + 700)
        list!.add(px)
        list!.add(py)
    next point
    drawpanel!.drawPolyline(list!)
next i
process_events

eoj:
release

See Also

BBjAPI

BBjSysGui

BBjWindow

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