• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GUI Builder Generated code

 
Martin Wells
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We all know that GUI builders do a great job in making GUI building easier, but unfortunately they create pretty horrendous code to look at.

I'm not sure whether I'll loose marks for submitting the code in it's current (horrendous) format. On the other hand, it would be a nightmare to make it look pretty and will no doubt cause problems for the GUI builder tool's parser if I want to make changes.

I'd be interested to hear your thoughts ranchers
 
R van Vliet
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Martin,

There are actually a few threads about this. GUI editor generated code, ugly or otherwise, is not code you created yourself and thus shouldn't be submitted.

That aside, it's actually quite easy to create a clean Swing GUI by hand and gives you more control when it comes to properly implementing your MVC.

Hope this helps.
 
Martin Wells
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good point. Thanks for the feedback.
 
Martin Wells
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to say that I was a little bit annoyed with myself having spent a week or so learning a GUI builder tool (Jigloo) and now having to scrap my work and start again by hand. However, this certification is all about understanding the APIs, conventions, design paradigms and so on.

My experience is in server-side development, and this is an opportunity for me to get a good understanding of new technologies (i.e. Swing). So, I am no longer annoyed and already making good headway into understanding the layout managers (probably the most complex aspect of GUI programming).

Using Jigloo is proving very helpful in learning Swing too. I generate a small part of my GUI (e.g. a JPanel with a couple of labels and textfields) and then look up the JavaDoc API & Tutorials for the layout managers to understand how it's all put together.

I then write the code from scratch in a much more readable/understandable form, commenting the code as I go along to re-inforce my understanding.

Here's a few links.

http://java.sun.com/docs/books/tutorial/uiswing/layout/visual.html

http://java.sun.com/javase/6/docs/api/java/awt/GridBagLayout.html

http://java.sun.com/javase/6/docs/api/java/awt/GridBagConstraints.html

http://www.cloudgarden.com/jigloo/
 
R van Vliet
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like a good approach. Understanding the code you're writing is key here, especially if you're interested in learning from the general SCJD experience rather than just worry about passing.

Good luck designing your UI, and focus on usability.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic