Results 1 to 1 of 1

Thread: adding thread

  1. #1
    amith is offline Member
    Join Date
    May 2008
    Posts
    24
    Rep Power
    0

    Default adding thread

    i sincerely apologize for asking this question again and again but i control it i am stuck by this program for past 3 days this time i am sending the .gif file so that u can easily understand what my idea is
    here is the code
    {code}

    import java.util.*;
    import java.awt.*;
    import javax.swing.*;
    class load extends JFrame
    {

    Image r;
    Image b;

    int y=329;
    int floor=329;
    int x=3;
    load()
    {

    super("some name");
    r=new ImageIcon("red.png").getImage();
    b=new ImageIcon("blue.png").getImage();

    getContentPane().add(new display());
    setVisible(true);
    setSize(175,400);
    setResizable(false);
    }

    class display extends JPanel //implements Runnable
    {
    //Thread t=new Thread(this);
    display()
    {
    repaint();
    }

    public void paintComponent(Graphics q)
    {
    Graphics2D n=(Graphics2D)q;
    q.drawImage(r,x,y,this);
    }
    /*
    i just want to place the red image fixed at the bottom
    and start new blue image thread i,e
    try
    {
    y=0;
    while(y!=floor)
    {
    y++;
    q.drawImage(b,x,y,this);
    Thread.sleep(10);
    }
    }
    catch(Exception e)
    {
    }
    */

    }
    }
    class f
    {
    public static void main(String args[])
    {
    new load();
    }
    }
    {code}
    Last edited by amith; 07-05-2008 at 05:53 PM.

Similar Threads

  1. data from the main/GUI thread to another runnin thread...
    By cornercuttin in forum Threads and Synchronization
    Replies: 2
    Last Post: 04-23-2008, 11:30 PM
  2. Replies: 0
    Last Post: 01-28-2008, 08:02 AM
  3. Adding taglibs in JSP
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-14-2008, 12:43 AM
  4. Adding a Restock Fee
    By Nexcompac in forum New To Java
    Replies: 2
    Last Post: 07-31-2007, 03:46 PM

Posting Permissions

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