Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

could not see the image on the screen  RSS feed

 
danesh far
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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);
}
}
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36463
462
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Karim",
As Marilyn pointed out, you need to change your display name. It needs to contain both a first name and last name.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This seems to be GUI related, so I'm moving it to our GUI forum.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!