help with image display gui  
Author Message
ben.jenson





PostPosted: 2006-7-24 9:23:00 Top

java-programmer, help with image display gui
hi wondered if anyone can help i want to create a dummy gui which looks

like a media player eg transition window buttons etc and have created
them as jpeg can someone help me in understanding how to inport them
into jframes etc and place there positions on the grid,
can gridbag place static images.is there any tutorials to do?

 
Ian Wilson





PostPosted: 2006-7-24 18:00:00 Top

java-programmer >> help with image display gui email***@***.com wrote:
> hi wondered if anyone can help i want to create a dummy gui which looks
>
> like a media player eg transition window buttons etc and have created
> them as jpeg can someone help me in understanding how to inport them
> into jframes etc and place there positions on the grid,
> can gridbag place static images.is there any tutorials to do?
>

I wouldn't repost the same request like this, you posted an identical
request just before the weekend. I'd wait a bit longer then consider how
to reformulate my request if it didn't seem to have what it takes to get
any response.

I Googled for "Java drawImage".

You can position graphics without using a GridBagLayout to layout
individual components each containing an image.

Image image = getToolkit().getImage(getClass().getResource("widget.jpg"));

public void paint(Graphics g) {
g.drawImage(image, 10, 30, this);
// ... draw other images at various coordinates
}

(I haven't tried the above, so I'd read the Javadocs carefully rather
than blindly trying this example. I recall you need to take care when
overriding paint() in this way but, since I've never done it, I don't
recall the details)

Personally I don't see what doing this in Java buys you, If you really
want to draw a GUI using JPEGs you might as well mock up the whole thing
in photoshop.

I mock up GUIs by contructing them in Java with JButtons, JPanels,
Layout Managers, etc. Just without implementing any actions. You can
"skin" components with images but I've never tried that.

myButton.setIcon(defaultIcon)
myButton.setPressedIcon(pressedIcon)

http://javaalmanac.com/egs/javax.swing/button_SetIcon.html