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

Comments for GUI Components

Return to GUI Components

bournebourne

2013/3/5

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 =)
UpupzealotUpupzealot

2013/3/5

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.
bournebourne

2013/3/5

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.
laziaflaziaf

2013/3/12

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
Might it be a good idea to use generics in places like the list-box?
bournebourne

2013/4/10

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).
Pressing delete makes a space?
bournebourne

2013/4/10

I can't relate to what you mean by "pressing delete makes a space"
danpostdanpost

2013/4/10

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.
JetLennitJetLennit

2013/4/10

same with any control/command and a key buttons
bournebourne

2013/4/10

Oh, forgive me I don't have that key on my keyboard and didn't realize greenfoot listened for it. Will account for it in next update.
DutaDuta

2013/4/10

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.
bournebourne

2013/4/10

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).
bournebourne

2013/4/10

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.
bournebourne

2013/4/11

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).
bournebourne

2013/4/11

Anti-aliasing *
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*
danpostdanpost

2013/4/13

The in-ability for Greenfoot to detect the "tab" key is either a BlueJ or Java issue; not a Greenfoot issue.
A new version of this scenario was uploaded on Sun May 05 03:52:59 UTC 2013
plsurveyorplsurveyor

2013/8/21

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?
bournebourne

2013/8/21

You may incorporate the Textbox class, as is or modified. Just don't let the project be "an implementation of a Textbox".
MatheMagicianMatheMagician

2013/8/22

Very clean and impressive!
JetLennitJetLennit

2013/10/9

Is it okay if I use this for some of my projects?
bournebourne

2013/10/9

Yes.
A new version of this scenario was uploaded on Wed Nov 13 06:14:00 UTC 2013 Preparation for a project coming soon.
KartoffelbrotKartoffelbrot

2013/11/13

Oh my god, my menu components are sooo bad :D
bournebourne

2013/11/13

Which of your menu components are you referring to?
KartoffelbrotKartoffelbrot

2013/11/13

I have some in my Combinatorial Circuit Editor and in my scenario of the Mandelbrot set.
bournebourne

2013/11/13

I think your menu navigation for your Combinatorial Circuit Editor is fine.
KartoffelbrotKartoffelbrot

2013/11/13

Thank you :) , but my textboxes are buggy.
shrucis1shrucis1

2013/12/21

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.
JetLennitJetLennit

2013/12/21

Is it a part of your project?
oooh! Is this the secret thing you were talking about previously?
bournebourne

2013/12/21

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.
RidicolasRidicolas

2016/11/26

its not running :(
MrBradleyMrBradley

2019/4/26

Bourne, I'm trying to get this running on GF3.1. Please contact me via a reply when you get this.
MrBradleyMrBradley

2020/7/23

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!
TakersTakers

2021/3/19

Hi MrBradley, I am interested in the new version of the code and it would be great if you could send me the updated version, Thanks!
MrBradleyMrBradley

2021/4/7

I have the updated version, but I'm not sure how to get it to you. Are you in Greenroom?
Game/maniacGame/maniac

2021/5/2

MrBradley, I think it's probably best to just upload it on your account. Just make sure to credit Bourne. He hasn't been active in a very long time