Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes Designing GUIs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Designing GUIs" Watch "Designing GUIs" New topic
Author

Designing GUIs

Phil Hopgood
Ranch Hand

Joined: Jul 14, 2008
Posts: 47
Howdy all, I'm a newbie .... why else would I be here.

However, just to give you some background: I've been programming in one form another for the past 30ish years .. scary .. the last 14 or so using Powerbuilder (PB) (javascript:%20x()... don't larf) and Oracle, developing client/server applications as a contractor. Now PB, bless it's cotton socks, is virtually dead in the UK and I need to find some other way to earn a crust. So I elected to xcross train into java - some would say a bit late in the day!

Now my question: I figured the best way to learn this stuff would be to grasp the basics (I'm nearly there) and then dive in and migrate a small bespoke PB app that I wrote for a local IFA. What's confusing me is that when I look at all the books and online tutorials for the GUI aspect of things I very much get the impression that the intention (at least originally) is to that it should be done textually.

Is that right?

Do java guys, in reality, really design GUIs textually as opposed to using an IDE?
[I should say I'm totally aware of the benefits of understanding the underlying code both from a learning angle and a development viewpoint. With PB there are times when it's far easier to go in and tweak things textually than fight the IDE]

One of the reasons I ask this is that, obviously, I'm trying to align my skills to maximize my chances of gaining new contracts whilst leveraging my experience. So, having determined that the main flavours of IDE seem to be Netbeans (which I'm using for some of my training) and Eclipse, I did some research (in the UK market) on JobServe. I found that Netbeans is very rarely a required skill and often AWT/SWING/GUI skills are mentioned with no reference to an IDE at all. This, coupled with the preponderance of tutorials and books to focus on the textual aspects of GUI development, led me to wonder if fully fledged java guys just used a textual approach. Hence the question.

Sorry if this seems a lame question but java's a big world and I'm having problems deciding where to concentrate my efforts.

I'm sure there will be more lame questions I'm afraid!

Regards and thanks for any insight you might give me,
Phil.
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

Hi Phil Hopgood welcome to Javaranch,

Originally posted by Phil Hopgood
Howdy all, I'm a newbie .... why else would I be here


No its not true, the ranch does have lot of authors, Java architects, and many such Java gurus.


Do java guys, in reality, really design GUIs textually as opposed to using an IDE?


Not really, I think and as you said you are getting familiar with Netbeans, it does come with a palette for GUI design.


Hoep this helps .


SCJP, SCWCD.
|Asking Good Questions|
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Amit Ghorpade:
Not really


Well, in fact, I do. I find that programming GUIs (in contrast to drag'n'dropping them) gives me more control and a lot of opportunities to remove duplication, which might be a bit more work to start with, but has a lot of advantages during maintenance.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41592
    
  55
Textually, a.k.a manually, for me too. Copy&Paste eliminates a lot of drudgery once you've built a few GUI apps.

As to IDEs in job ads, most companies I've seen allow their developers to use whatever they're comfortable with, so there's little point in requiring experience with any particular one.


Ping & DNS - my free Android networking tools app
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

I agree Ilja but the original poster wanted to know if IDEs can be used for GUI.
And also IDE is advised for rapid development.
Thanks
Phil Hopgood
Ranch Hand

Joined: Jul 14, 2008
Posts: 47
Thanks to you all for taking the time to respond.

I don't think I made myself quite clear though, so to clarify my question;

Do many java developers in practice develop GUI apps solely using a textual approach?

I am just trying to get an idea of what is good practice, a straw poll if you will, and the reasons for adopting one approach over the other.

Having used IDEs for the last 14 years I am aware that they can be used, depending on the IDE, to produce GUIs ...... among many other things.

Ulf: Maybe you're right about companies letting the individual decide on the tools they want to use. I guess it's my Powerbuilder background colouring my view since Powerbuilder relies heavily on its' IDE (though as I said there are times you want to go in and tweak the code).

So when I am looking for contracts, Powerbuilder skill is what clients are generally looking for and since the term Powerbuilder refers to both an IDE and a 4GL I lump them both together.

Java, I now realise, is not like that since it's genesis is from the C/C++/Unix background (have I go that right?) which is predominantly text based.

I just found it odd that one would design something that was essentially visual by using a descriptive text. After all you wouldn't ask a guy to build your house by giving him a worded description of it, you'd give him a set of drawings. Same with graphic artists

........ but having said that when I design a web page I purposely use a textual approach (HomeSite)

..... so maybe I should look more closely at designing GUIs manually

... hmmmm I'll have to think about it.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Hi Phil,

Note that most Java programming doesn't involve AWT/Swing at all; most Java programming these days is server-side code, with GUIs in HTML. There are plenty of GUI builders, both for browser-based and desktop-based apps, and there are people and shops who use them, but I think you'll find that many if not most Java GUIs are, indeed, built with code rather than a graphical builder. The reason being that good hand-built GUI code is smaller, easier to maintain, and easier to test -- all qualities that the Java community places a premium on. Perhaps this is because there isn't a single unifying IDE, it's important that Java code be usable with different tools over time and space, and avoid vendor lock-in -- really good reasons to avoid GUI builders.

One thing that you many find that's a basic philosophical difference between the PowerBuilder world and the Java world is that Java applications are usually built with a strict separation between layers; many of the available tools try hard to make this possible. Because Java apps are built in separate layers, and technologies are mixed-and-matched across the layers, you don't have the single unified toolset that PB gives you. Instead, IDEs like Eclipse and Netbeans are themselves a sort of bazaar of different plug-ins that do different things; you can use whichever JSP editor or database tools or GUI designer is most suited to a particular task.


[Jess in Action][AskingGoodQuestions]
Phil Hopgood
Ranch Hand

Joined: Jul 14, 2008
Posts: 47
Thanks Ernest,

That's a very useful comment.

You may just have saved me from devoting too much effort on replicating and honing my GUI skills using SWING when I should have been concentrating on server side and HTML....... and, point taken re hand coding GUIs.

Thanks very much!
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Just to back up Ernest's post a bit I too hand code Swing rather than using GUI builders. Most GUI builders use Gui Builder friendly layout managers (Netbeans' Matisse) which means that when it does come time to dig and and tweak some things it is much too complex. Not to mention just general code generation engine's really stink.

That said, I have lately been using a tool that allows you to define your UI in a YAML based file while all the grunt work is done in a Java file. The YAML file just takes care of things like:

button = new JButton("Push Me");

While the Java file handles all the events and what not. This has allowed me to keep my java files quite a bit cleaner. There are many libraries available that let you do this, most will have you define the UI in XML rather than YAML. Its just preference.

Also, helpful hint, when developing Swing GUI's Miglayout is your friend. It is a layout manager designed for hand coding UI's. I use it for nearly all my complex layouts.


GenRocket - Experts at Building Test Data
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41592
    
  55
Gregg's point about using a markup language is a good one. Occasionally I've used Thinlet as an XML wrapper around AWT. It moves the GUI definition to an external XML file. Now, Thinlet doesn't support Swing, so it's missing a lot of functionality you'd want in a complex app, but it illustrates the point.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14114
    
  16

Besides Thinlet, there are other tools / libraries that allow you to declare your GUI with an XML file. Here's a list of open source XML UI Toolkits in Java.

Even in the standard Java library there is (limited) support for this; have a look at the classes XMLEncoder and XMLDecoder in the java.beans package. The API docs of class XMLEncoder contain an example of how to use this for a Swing GUI.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

BTW, here is a link to the library I've been using. I wouldn't say jump right into any of these until you are comfortable with Swing. But just to give you some future pointers.
Phil Hopgood
Ranch Hand

Joined: Jul 14, 2008
Posts: 47
Thanks once again everyone for your inputs, they're all very much appreciated.

It's great to find a site that treats newbies as human and gives such excellent help and advice instead of the usual load of rhetoric!

Ah well, gotta hit the books and the tutorials now.

c ya.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Designing GUIs