File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes GUI question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

GUI question

danesh far
Greenhorn

Joined: Nov 25, 2004
Posts: 15
I�ve written the following class ShowImage to put image on the screen but what I got was a blank window.Why could not I see the image on the screen?



import javax.swing.*;
import java.awt.*;


public class ShowImage extends JFrame {

public static void main(String[ ] args) {

ShowImage si=new ShowImage();
Graphics g=si.getGraphics();
Image im;
Toolkit T=si.getToolkit();
im=T.getImage("Jumbo.jpg");
g.drawImage(im, 50,50,si);
}
public ShowIm(){
this.setSize(770, 420);
this.setVisible(true);
}
}
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1824

There seems to already be several threads relating to this question -- please do not cross-post / post multiple times. I am closing this thread; please direct all responses here
[ November 26, 2004: Message edited by: Joel McNary ]

Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: GUI question