Results 1 to 3 of 3

Thread: Resizing Applets?

  1. #1

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Resizing Applets?

    Does anyone know if an applet can be resized? I know when using the appletviewer it can.

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    I think I saw it once. No clues as to how.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    What i am trying to do is set the size of an applet to the size of an Image.
    Code:
      import java.awt.*; 
      import java.net.*;
      import javax.swing.*; 
      import java.applet.*; 
     
      public class AvatarViewer extends Applet{
     
       private Image image; 
    
       public void init(){
        try{
     //  image = getImage(newURL("file:///C:/Pics/braninlittlechina.jpg"));
          image = getImage(new URL("file:///C:/Pics/vampire.gif"));
          setSize(image.getWidth(this), image.getHeight(this));  
        }catch(Exception e){System.err.println(e);}
      } 
       public void paint(Graphics g){
        g.drawImage(image,50,50,this); 
       }   
      }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width