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

2012/5/31

Java Components

Julian Julian

2012/5/31

#
I now wish to add some TextFields and tick boxes. I have found some really great scenarios: GUI World, UILibrary, GUI Components. But none of them seem to use the AWT or Swing Compunents. Why is this?
erdelf erdelf

2012/5/31

#
I would say they have better ways to make a GUI
Julian Julian

2012/5/31

#
No thats not quite what I mean. I am very new to Java and finding it very had to crowbar OOPs into my Proccedure based crainium. But in general in is better not to keep reinventing the wheel. AWT and Swing seem to have very capable components already. And since one of the aims of the Greenfoot project is to set leaners on the road to becomeing compentant Java programmers, using the Standard Class Libraries would seem a good thing. Or is it that the design of the Greenfoot simulation mitigates against using certain Java packages? My reading suggests that Java components must be placed in a "Container". Is this why, say: TextField cannot be added to a Greenfoot world, because the Greenfoot world does not extend the "Container" class. But now I am completely outside my knowledge zone, so what I have just written could be complete gibberish.
davmac davmac

2012/5/31

#
A Greenfoot world isn't a Swing container, that's true, so you can't directly use Swing components within a Greenfoot world. More importantly, Greenfoot is for beginning Java programmers and Swing is not. Even though on the face of it the Swing API looks simple, there are many complexities when it comes to actually implementing a GUI in Swing. While I agree with the statement that you "shouldn't reinvent the wheel" in the broader sense, for beginners, re-inventing wheels can be a good way to learn :)
Julian Julian

2012/5/31

#
Thank you for a clear reply. And I agree reinventing can be good for beginners. Now that I know the AWT or Swing route is not valid for this part of my project. I am now really looking forward to dissecting the scenarios I have found. To workout what the programmers did, and to understanding why they did it that way; a bit like taking my toys apart to see how they worked .
You need to login to post a reply.