Image placement

N

nick yakman

How can i place an image to the east-side of an applet.

I am using BorderLayout, but can't seem to add my Image pic1.jpg, using:

Image pic;
pic = getImage(getDocumentBase(), "Pic1.jpg");
add(pic, BorderLayout.EAST);

The only way i have managed is using:

public void paint(Graphics g)
{
g.drawImage(pic, 350, 250, 400, 300, this);
}

but if the window is resized the image gets covered.

Many Thanks
K Yakman
 
M

mromarkhan

From sun.com
The default layout manager for a panel is the FlowLayout layout manager
+-java.awt.Panel
|
+-java.applet.Applet

I'm not sre if this is the issue that an applet
is a panel an has a default layout of flow.
This can be change to border by
calling setlayout or invoking.

Have a good day.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,771
Messages
2,569,587
Members
45,099
Latest member
AmbrosePri
Top