wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes help GUI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "help GUI" Watch "help GUI" New topic
Author

help GUI

Shouvik Biswas
Greenhorn

Joined: Feb 09, 2007
Posts: 5
I am new to Java and wish to create GUI applications (windows look) using Java. I was going through swing-tutorial in <java.sun.com> site. Its vast and am unable to relate one chapter to the other. Is there any good book or site that I may go through to learn on how to do this.
PS: Though i must tell you that I am not aware of AWT, however aware of Core Java.
Any help is appreciated.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10175
    
    8

I can understand your predicament.
One way of tackling it is starting of small and building up on it, while learning on the way.

I personally found Core Java by Horstmann and Cornell very easy to understand. Needless to say, others can recommend more books/sites.

AWT was the precursor of Swing.
If you google for AWT Swing difference, you can find out more information.

I am moving this to the Swing forum where you stand a better chance of getting help and ideas.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Brian Cole
Author
Ranch Hand

Joined: Sep 20, 2005
Posts: 862
Originally posted by Bharat Chatla:
I have a pixel array and I want to write that image to disk. Below are the methods but when I run the program I get NullPointerException.


Exception in thread "main" java.lang.NullPointerException
at java.awt.image.SinglePixelPackedSampleModel.setPixels(Unknown Source)
at java.awt.image.WritableRaster.setPixels(Unknown Source)


WritableRaster.setPixels is documented to throw NullPointerException if the array in null, so I'd look there first.

Stepping back a bit, what is this code supposed to do? It seems to me that it is
1) creating a blank BufferedImage
2) obtaining a copy of its pixel data (as a Raster)
3) casting the Raster to a WritableRaster (which is not guaranteed to succeed)
4) altering the pixel data (the copy, not the original)
5) returning the still-blank BufferedImage

Presumably, this is not your intent.

PS. JavaRanch admins, for some reason clicking on the "quotes" button resulted in the post going to this different thread. [update: same URL as this thread--see here] Configuration issue? So now I'm trying it with the "post reply" button at the bottom of the page.
[ November 04, 2008: Message edited by: Brian Cole ]

bitguru blog
Shouvik Biswas
Greenhorn

Joined: Feb 09, 2007
Posts: 5
Maneesh,
Thanks for helping me and putting the request on the swing forum. Will try the recommended books. However, the swing forum didn't help yet. Any further suggestions...

Regards.
Jorge Bendahan
Ranch Hand

Joined: Apr 11, 2008
Posts: 82
it's something like this:
UIManager.setLookAndFeel(
UIManager.getSystemLookAndFeelClassName());
got the code from: http://java.sun.com/developer/JDCTechTips/2004/tt0309.html
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
Originally posted by Shouvik Biswas:
However, the swing forum didn't help yet...


If you spend any time here, you'll find that our ability to help often depends upon the question. Very specific questions often get very specific and helpful answers. Your question however is very broad. I can only second the Core Java recommendation as I have both volumes and find them to be very helpful, and also I recommend that you continue to go through the Swing tutorials on the Sun site as with time and concentrated effort, it will eventually all click together. In fact a good plan would be to tackle a tutorial section or two each week and come back here if you have any specific point of misunderstanding from the tutorial. Much luck.
Jorge Bendahan
Ranch Hand

Joined: Apr 11, 2008
Posts: 82
Originally posted by Jorge Bendahan:
it's something like this:
UIManager.setLookAndFeel(
UIManager.getSystemLookAndFeelClassName());
got the code from: http://java.sun.com/developer/JDCTechTips/2004/tt0309.html


totally misinterpreted the question, sorry...
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> and wish to create GUI applications...

your question is similar to
"I wish to build a car, are there any good step-by-step books"

the answer is you don't 'build a car', you instead build a motor, a gearbox, a chassis etc
and you put them all together - end result is a car.

in swing, you plan (depending on funcionality) what components to use,
(V8 or 6-cyl, auto gearbox or manual etc).
after determining the components to use, you choose what layout manager/s
will best display those components (soft-top/hard-top, 2-door/4-door etc)

at the end you'll have a GUI, and there's not a book in the world that would have been able to describe step-by-step how you did it.

the swing "How To's" page is worth bookmarking

http://java.sun.com/docs/books/tutorial/uiswing/TOC.html
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10175
    
    8

I agree with Pete and Michael.
Best way to learn is start off small and keep on building on it.

Why don't you try out something simple (a notepad like text editor maybe) to start with? If you get stuck on anything, you can always post your problematic code here and I am sure people will lend a helping hand. The demo/jfc directory of your jdk installation should have a SwingSet jar. If you run it, you can get an idea of what all things are possible in Swing.

Pssst. You might feel a bit awkward initially as you might find your questions silly. But if you browse the forums, you will come across questions which are even sillier
So go ahead! Ask away!
Shouvik Biswas
Greenhorn

Joined: Feb 09, 2007
Posts: 5
Dear all,
Thanks for the suggestions and ideas. Will do as suggested.
Regards.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: help GUI
 
Similar Threads
aiding terrorism
compiling a file from the GUI
Reading a .properties file from client site
Class Library :(
Get file sharing.