This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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.
subject: GUI question
Similar Threads
problem with GUI
could not see the image on the screen
Display image in a BorderLayout
jsp to display image
Zoom In/Zoom Out Image with j2me