GUI frustrations - using Eclipse and now Windows Builder
Ok, so I have read a book on Java programming and gone through many tutorials on the language through websites and youtube. Now I just want to make a simple game to get started, no serious graphics or anything.
I have been at it for days and am about to give up on Java. The GUI is impossible to program. Examples from websites don't seem to even work. For example just trying to get a jpg to show on a jpanel. I got this code snipet:
ImageIcon image = new ImageIcon("image.jpeg");
jpanel.add(image, BorderLayout.North);
but the add method does not work, some error about image not being a component.
Eventually I did get it to work, using a jlabel instead.
Now I am working on getting my buttons to show where I want them to. I do not just want a layout manager to slap them up, I want very precise control of where they appear.
To help, I even tried using google's Window Builder. But it is seems overly cumbersome. Additionally, I have not successfully added the images to my project (it shows up there, but when linked to jlabel they dont show up) so I have to use a file system path which of course is useless when I try to share this application.
So here are my questions:
Why does it have to be so difficult to create a simple GUI?
Is Java a useable language for this type of project? I want to have a background image and then place buttons and other images on top of it. For example one large 1024X768 image that is the size of my application, an other image of my "hero" and then a semi-transparent red rectangle over it which covers it up more and more as he takes damage.
And what am I doing wrong?!
thanks!