I will consider some graphic options when I get everything done, but focus now is on functionality, which there is always more to do in different projects. And basic is always clean =)
yes, functions comes first.
Another suggestion is try to make things clear, like Greenfoot itself. We don't need another swing, we need our own GUI components which has less api
and easier to handle.
Just suggestion, after all, very great job.
I am working on extensive documentation/comments. And I do believe having a GUI that works "inside" Greenfoot is more elegant for Greenfoot projects than using swing that "interrupt" the program.
A new version of this scenario was uploaded on Wed Mar 06 07:05:23 UTC 2013
Now even easier to create Windows with Container class. More comments in source to come, hopefully soon.
i have a trouble, I made a game using a countdown timer using Edit> import class> counter, a maximum of 40 to 0, and if up to 0 game over. the problem is, time is running very fast, and I do not know how to slow down time as a matter of seconds. I need your help. thanks
Very good! Yes that makes sense for the listbox, (possibly also for the dropdownlist) not sure for what other places? Thank you for the suggestion. I will try to implement that soon. Nice to have constructive feedback, mostly only have additions to this set of classes through my own specific needs in my projects. I know I have been asked for graphic options at least once, unfortunately it requires a great deal of extra "fluff" to integrate within the already somewhat complicated items, while the existing graphic simplicity has always had its appeal (to myself).
What FlyingRabidUnicornPig is saying is that while editing the text in the TextBox object, if the user presses the 'Del' key, it appears to add a space.
In the password box, if you press Enter it adds a character to the pw box -- This is probably not what'll be wanted for most situations. Maybe just add a check in to suppress it from being entered? Hell, you could even (in the same check) add in a hook so that people who subclass it could have an "onEnterPress" action.
I don't believe ctrl, command, or alt combinations are captured by Greenfoot, nor do those keys alone seem to be accepted by the Textbox. I did realize that Enter was counted as a character for the password setting, which should be suppressed, but I think having a "log in"/"Enter" sort of button accompanying the Textbox, that has acceptance on Enter key press will be suitable (which I will include next).
Learn something everyday, on mac, fn-delete is same as 'Del'.
Also fn-ctrl, fn-alt.
(These Key Names are missing from the Greenfoot API by the way).
Already finished:
* Listbox to have generics
* 'del' functioning for Textbox
* Textbox doesn't accept Enter when on password setting.
* limited Textbox to not accept ctrl and alt combinations (for now).
Gonna update code comments and see if there's some more polishing I can do before updating.
A new version of this scenario was uploaded on Thu Apr 11 04:52:26 UTC 2013
TextBox now supports text selection. Also does copy and paste, with your system's clipboard (creates own local clipboard on Gallery because of AccessControlException).
ListBox and DropDownList use generics.
Some minor changes/fixes.
A new version of this scenario was uploaded on Thu Apr 11 04:59:53 UTC 2013
TextBox now supports text selection. Also does copy and paste, with your system's clipboard (creates own local clipboard on Gallery because of AccessControlException).
ListBox and DropDownList use generics.
Some minor changes/fixes.
Don't know why, when exported, fonts don't have antiasing and fontmetrics seem to be less accurate. Or is it just me? (don't remember it always looking this way).
A new version of this scenario was uploaded on Fri Apr 12 04:56:55 UTC 2013
TextBox: Forgot to add "cut" (ctrl+x). Fixed bugs and reorganized code.
A new version of this scenario was uploaded on Fri Apr 12 20:19:33 UTC 2013
TextBox: Autoscroll for when selecting text (dragging mouse off edges) no longer requires continued drag movement.
A new version of this scenario was uploaded on Fri Apr 12 21:52:11 UTC 2013
TextBox: New border.
*Would implement tabs if Greenfoot listened for the key like its API says it should*
Hi Sir, I saw you commented on a post with
"You can check out how I did my Textbox at:
http://www.greenfoot.org/scenarios/7578
And feel free to use it."
I want to ask permission to strip your code and just retain the textbox and use that for my school project. May I?
Hey bourne, when looking at your code, I noticed this interesting little statement:
if(CodeGenerator.haveUser())...
But the source code for Code Generator was not included.
When I changed this statement to false, I notice that this appears at the end of the textbox:
"Enter this code into bourne's Residents scenario: OVGDPLDO"
Just curious, but what does this mean? I couldn't find your Residents scenario, if you have one.
It is indeed my big project that is nearly ready. The code will unlock something in it for you. The code will be different from that what it gave you now. And unique to you, more details when I upload my project.
A new version of this scenario was uploaded on Sun Jan 26 00:51:52 UTC 2014
Made all text anti-aliased. Bug fixes. Improvements. Made the Demo World code more readable.
A new version of this scenario was uploaded on Fri Jan 31 21:21:45 UTC 2014
A couple small fixes to the TextBox.
** The select Color is no longer set permanently as Yellow, but now uses GUI_Component selectColor - influenced by the static setDefaultColors method, and can be changed via the inherited setSelectColor(Color) method.
** Using the setText(String) method will reset the scroll to the "top", was a noticeable bug when having scrolled down some text, then using the setText method with a sufficiently large String
A new version of this scenario was uploaded on Mon Mar 10 19:22:17 UTC 2014
GUI_Component now has a protected method redraw() which is called whenever one of its set color or font methods are invoked. This method is used for those GUI_Components that avoid redrawing every act cycle. Overwrite it to make use of it.
The Container class now listens for if its components have resized, needing to redistribute them.
Included the Spacer and ImageHolder classes.
A number of other improvements.
A new version of this scenario was uploaded on Mon Apr 28 19:18:04 UTC 2014
* TextBox: double/triple click to select "word" or line. Small fixes to FontWindow.
* Improvements to ListBox. ListBox only redraws when needed. ListBox has better border. Some small improvements to GUI_Component.
* Improvement to DropDownList. Additional fix on Window close on lose focus bug.
* Button and Window now have better border, no longer single line. CheckBoxLabel enable/disable feature. Improvements to Window. Window bug fix where if the Window is set to close when lose focus, it closed if one of its components were clicked on and not gaining focus before Window realizes it no longer has focus.
A new version of this scenario was uploaded on Mon Apr 28 21:52:52 UTC 2014
TextBox focusable enable/disable feature. Fix where select by dragging would deselect when finished.
In case anyone is interested, I have ported this to work under version 3.1. (Suspect it will work up to 3.5.x)
It's shelf life is limited as GF moves toward FX, but these are very good examples for creating GUI component.
Also included are conversion utilities as adapters to go from GF Color/Font <==> awt Color/Fonts.
Even if you can't run them - the code is worth looking at. Well done Borne!
2013/3/5
2013/3/5
2013/3/5
2013/3/12
2013/4/10
2013/4/10
2013/4/10
2013/4/10
2013/4/10
2013/4/10
2013/4/10
2013/4/10
2013/4/10
2013/4/10
2013/4/11
2013/4/11
2013/4/13
2013/8/21
2013/8/21
2013/8/22
2013/10/9
2013/10/9
2013/11/13
2013/11/13
2013/11/13
2013/11/13
2013/11/13
2013/12/21
2013/12/21
2013/12/21
2013/12/21
2016/11/26
2019/4/26
2020/7/23
2021/3/19
2021/4/7
2021/5/2