Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > ImageIcon.paintIcon wont work in JApplet

Reply
Thread Tools

ImageIcon.paintIcon wont work in JApplet

 
 
Cheok Yan Cheng
Guest
Posts: n/a
 
      08-13-2003
dear all,
i try to dispaly d icon within d JApplet but it wont work. the
following code compiled no problem but nothing had been shown

any suggested solution on this problem?

thank you.

regards
yccheok
-------------------------------------------------------------------------------

// LoadImageAndScale.java
//
// Load and display the image as an ImageIcon.
import java.applet.Applet;
import java.awt.*;
import javax.swing.*;

public class LoadImageAndScale extends JApplet
{
private ImageIcon logo2;

// load the image when the applet is loaded
public void init()
{
logo2 = new ImageIcon( getCodeBase()+"logo.gif" );
repaint();
}

// display the image
public void paint( Graphics g )
{
logo2.paintIcon( this, g, 0, 0 );
}
}
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
wont start,wont stop hunty Computer Support 4 06-04-2006 05:26 PM
my JApplet, doesn't work in Web Browser Peace Java 2 09-29-2005 06:42 AM
Re: newbie: Join JApplet & Applet in one applet Andrew Thompson Java 0 08-05-2003 01:41 PM
Re: JApplet + API question Eric Olander Java 1 07-08-2003 04:03 PM
Re: JApplet + API question John C. Bollinger Java 0 06-27-2003 05:13 PM



Advertisments