Squeakあれこれ

Squeak関連情報など

TextStreamあれこれ #2

2005-03-19 | squeakあれこれ
TextStream第2弾.
| ts |
ts := TextStream on: (Text new: 100).
"font size"
ts nextPutAll: 'TextFontChange ';cr.
ts withAttribute: (TextFontChange fontNumber: 1)
	do: [ts nextPutAll: 'font 1']; cr.
ts withAttribute: (TextFontChange fontNumber: 2)
	do: [ts nextPutAll: 'font 2']; cr.
ts withAttribute: (TextFontChange fontNumber: 3)
	do: [ts nextPutAll: 'font 3']; cr.
ts withAttribute: (TextFontChange fontNumber: 4)
	do: [ts nextPutAll: 'font 4']; cr.
ts withAttribute: (TextFontChange fontNumber: 5)
	do: [ts nextPutAll: 'font 5']; cr.
"link to URL"
ts withAttribute: (TextURL scanFrom: 'http://www.yahoo.co.jp')
	do: [ts nextPutAll: 'www.yahoo.co.jp']; cr.
"link to project"
ts withAttribute: (TextSqkProjectLink scanFrom: '名無し')
	do: [ts nextPutAll: 'Go to ''名無し'' project']; cr.
(Workspace new contents: ts contents)
         openLabel: 'TextStreams'

最新の画像もっと見る