The BorderedMorph class
Every morph providing a border is a direct or indirect subclass of BorderedMorph. A border has a border width and a color specified in the instance variables borderWidth and borderColor.
In the drawing category you will find the instance method drawOn: which draws the border on a canvas.
drawOn:
aCanvas "Draw a rectangle with a solid, inset, or raised border. Note: the raised border color is generated from the receiver's own color, while the inset border color is generated from the color of its owner. This behavior is visually more consistent. Thanks to Hans-Martin Mosner." | insetColor | borderWidth = 0 ifTrue: [ "no border" aCanvas fillRectangle: bounds color: color. ^ self]. borderColor == #raised ifTrue: [ ^ aCanvas frameAndFillRectangle: bounds fillColor: color borderWidth: borderWidth topLeftColor: color lighter bottomRightColor: color darker]. borderColor == #inset ifTrue: [ insetColor := owner colorForInsets. ^ aCanvas frameAndFillRectangle: bounds fillColor: color borderWidth: borderWidth topLeftColor: insetColor darker bottomRightColor: insetColor lighter]. "solid color border" aCanvas frameAndFillRectangle: bounds fillColor: color borderWidth: borderWidth borderColor: borderColor. |
Subclasses like ElipseMorph override this method to draw themselves with a more specialized border.
You can easily open an instances of BorderedMorph by opening a new Morphic world and selecting <New morph... - Kernel - BorderedMorph> from the world menu.