File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

GUI question

danesh far

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();
g.drawImage(im, 50,50,si);
public ShowIm(){
this.setSize(770, 420);
Joel McNary

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.
It is sorta covered in the JavaRanch Style Guide.
subject: GUI question
It's not a secret anymore!