Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Event Streams in Action this week in the Java in General forum!
    Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

GUI question

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • 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);
}
}
 
Bartender
Posts: 1840
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
  • Report post to moderator
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 ]
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!