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

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
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: 1817

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.
jQuery in Action, 2nd edition
subject: GUI question