This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

danpost
danpost presents ...

2014/8/13

TextImage Support Class

See scenario for description.
Click the big green 'Open in Greenfoot' button on right to download or view in greenfoot.
Copy the TextImage.JAVA file from the project folder to your 'Greenfoot/lib/greenfoot/common' folder to allow easy addition into your scenarios using the 'Edit>Import class...' option from the menubar.

CONTROLS:
- click buttons to view source code for the class
- use 'up'/'down' arrows or drag handle on vertical scroll-bar to scroll text
- press 'x' or 'escape' to exit source code viewing

Update 8/13/2014 (1):
* added 'getText' method
* added 'TextImage(String, Font)' constructor
Update 8/13/2014 (2) -- non support class changes:
* simplified some code
* added buttons for source text viewing utilizing the TextImage class
Update 8/14/2014 (1):
* added 'cloned' method
Update 8/14/2014 (2 to 4) -- non support class changes:
* added examples of using environment fonts
Update 8/20/2014:
* added font list with related methods
Update 8/22/2014:
* added default value changing methods

7605 views / 30 in the last 7 days

4 votes | 0 in the last 7 days

Tags: demo with-source danpost support source-text text-image fonts

This scenario is a member of: Support Classes by danpost


open in greenfoot
Your browser does not support the canvas tag.
vessaliuzzvessaliuzz

2015/7/1

private void createCounters() { boardLabel = new Text("BOARD " + board); addObject (boardLabel, 670, 120); tryLabel = new Text("Nyawa: " + tries); addObject (tryLabel, 670, 150); rollsLabel = new Text("Kesempatan : " + rolls); addObject (rollsLabel, 670, 200); scoreLabel = new Text("Score: " + score + " "); addObject (scoreLabel, 670, 230); } i tried to change Text into TextImage, but error. so what should i do, n what should i write on the Board class to make it bold
A new version of this scenario was uploaded on 2017-01-22 09:22:54 UTC Fixed some constructorss missing default values.
Nosson1459Nosson1459

2017/2/16

With the listFonts() method in only shows the last 45 fonts that I have. I made my own method in the class which saves the fonts to a text file and it shows ALL my fonts.
Nosson1459Nosson1459

2017/2/16

I just saw "NOTE: DO NOT MODIFY THIS CLASS -- except for the five static 'default' fields in the modifiable section below fields.". But I technically could edit it, just maybe before I do too much testing I should copy it into the Greenfoot folder mentioned above (I also just saw that).
Nosson1459Nosson1459

2017/2/16

"Copy the TextImage.JAVA file from the project folder to your 'Greenfoot/lib/greenfoot/common' folder to allow easy addition into your scenarios using the 'Edit>Import class...' option from the menubar." Why not the CLASS file, that way it will be there but you won't see it in the Greenfoot sidebar? (But I guess then it might not show up in the import class list, I don't know much about it.)
danpostdanpost

2017/2/16

As far as the number of fonts showing up -- you probably have the terminal set to limited output. On the terminal frame menubar, go to 'options>Unlimited buffering'.
Nosson1459Nosson1459

2017/2/17

Thanks for the help.
A new version of this scenario was uploaded on 2020-11-25 16:51:26 UTC
tszsltszsl

2022/2/14

Is there a version which runs embed? I always get an reference error
danpostdanpost

2022/2/14

The class can now only be used locally (not on a site). For help on error, create a discussion thread. Show class of code where error is located and indicate what error you are getting and at which line it occurs.

See all comments

Want to leave a comment? You must first log in.

Who likes this?

Carryminati MrCohen Nosson1459 Dalvengyr