Drawing an Image in a JPanel
- From: "john" <eyal9911@xxxxxxxxxxx>
- Date: 30 Aug 2006 02:11:55 -0700
I'm using Netbeans GUI and wrote the following code to draw an Image in
a JPanel. It works fine until I switch windows and then the image is
gone.
I am aware to the paint function but I don't know how to make sure to
redraw the image inside the JPanel. I do want to be able to target it
to the JPanel borders.
Any ideas?
Many thanks
John
Here is my code, ImageCrop_Panel is a JPanel created with the GUI tool
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
this.jFrame1.setVisible(false);
Graphics g = this.ImageCrop_Panel.getGraphics();
g.drawImage( img1, 0, 0, this );
}
.
- Follow-Ups:
- Re: Drawing an Image in a JPanel
- From: Andrew Thompson
- Re: Drawing an Image in a JPanel
- Prev by Date: Re: Vector efficiency
- Next by Date: Type safety ... References to generic type Enumeration<E> should be parameterized
- Previous by thread: Loading of dll file
- Next by thread: Re: Drawing an Image in a JPanel
- Index(es):