|
|
Re: a simple problem with GUI
|
Posted: Nov 26, 2004 5:37 AM
|
|
I think your problem ist that the System calls the paint() method wich empties the window since you did not override it.
Example:
import javax.swing.*;
import java.awt.*;
public class ShowImage extends JFrame {
public static void main(String[ ] args) {
ShowImage si=new ShowImage();
si.setSize(770, 420);
si.show();
}
public void paint (Graphics g) {
//Graphics g=si.getGraphics();
Image im;
Toolkit T=si.getToolkit();
im=T.getImage("Jumbo.jpg");
g.drawImage(im, 50,50, this);
}
}
This certainly will not solve all of your problems, but it is a start.
|
|