Results 1 to 2 of 2

Thread: ***RESOLVED***image icons in an applet

  1. #1

    Thread Starter
    Addicted Member annie613's Avatar
    Join Date
    May 2003
    Location
    NY, NY
    Posts
    161

    ***RESOLVED***image icons in an applet

    im recieving an error from this code
    Code:
    //declare vars
    //images
    Icon image1= new ImageIcon("image1.jpg");
    Icon image2= new ImageIcon("image2.jpg");
    
    //init()
    getContentPane().add(image0);
    image0.setBounds(12, 155, 100, 50);
    getContentPane().add(image1);
    image1.setBounds(25, 255, 100, 50);
    
    ????can anyone suggest why this will not appear
    
    these are the messages i recieve
    
    1cannot resolve symbol: method add (javax.swing.Icon) in class java.awt.Container
    2cannot resolve symbol: method setBounds (int,int,int,int) in interface javax.swing.Icon
    3cannot resolve symbol: method add (javax.swing.Icon) in class java.awt.Container
    4cannot resolve symbol: method setBounds (int,int,int,int) in interface javax.swing.Icon
    
    so i know its the four lines in init()
    what can i do to resolve this
    
    i think i have all the correct libraries i ineed in my applet???
    
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.util.*;
    import java.io.*;
    import java.sql.*;
    import symantec.itools.db.beans.jdbc.*; 
    import java.util.Date;
    import java.text.DateFormat;
    thanks in advance annie
    Last edited by annie613; Apr 1st, 2004 at 10:21 PM.

  2. #2

    Thread Starter
    Addicted Member annie613's Avatar
    Join Date
    May 2003
    Location
    NY, NY
    Posts
    161
    i love when i figure it out on my own

    i forget to set labels

    //images
    Icon image0 = new ImageIcon("image0.jpg");
    Icon image1 = new ImageIcon("image1.jpg");
    JLabel aimage = new JLabel(image0);
    JLabel simage = new JLabel(image1);

    //init
    getContentPane().add(aimage);
    aimage.setBounds(12, 155, 100, 50);
    getContentPane().add(simage);
    simage.setBounds(25, 255, 100, 50);

    works now

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