mte01
asked on
PictureBox in Java
Hey experts,
Is there something like a JPictureBox in java, in which we can display a bitmap or jpeg image??
Is there something like a JPictureBox in java, in which we can display a bitmap or jpeg image??
any container can display a picture... just call paintPicture method of Graphics object
ASKER
you mean something like this:
JPanel jp = new JPanel();
jp.getGraphics().paintPict ure("pictu re.bmp");
JPanel jp = new JPanel();
jp.getGraphics().paintPict
ASKER
Is my above code correct according to what you said bobbit31 ??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
actually, i meant overload the paint() method of the container:
public void paint(Graphics g) {
g.drawImage(img, x, y, null);
}
where img is an instance of Image class
public void paint(Graphics g) {
g.drawImage(img, x, y, null);
}
where img is an instance of Image class
ASKER
OK....that's what I needed...thanks!
ASKER
udo_borkowski's mthod is much easier....