Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-27-2008, 10:28 PM
Member
 
Join Date: May 2008
Posts: 22
amith is on a distinguished road
problem with threads
import java.awt.*;
import javax.swing.*;
class d extends JComponent implements Runnable
{
Image r;
Image g;
int y=0;
long floor=329;



public void run()
{
r=new ImageIcon("red.png").getImage();
g=new ImageIcon("blue.png").getImage();
try
{
while(y!=floor)
{
y++;
repaint();
Thread.sleep(10);
}
}
catch(Exception e)
{
}
}

public void paint(Graphics q)
{
q.drawImage(r,229,y,this);
q.drawImage(g,229,y-32,this);

}
}


class f
{
public static void main(String args[])
{
d v=new d();
JFrame b=new JFrame("sdfdsf");
b.getContentPane().add(v);
b.setVisible(true);
b.setSize(300,400);
(new Thread(v)).start();
}
}
in this code i had uploaded two image files iam using the thread so that using sleep method it comes slowly from y=0 and stops at point y=329 the first image should stop and it is stopping also and after that i just want to create another thread so that the existing image which had stopped at point y=329 should exist in the jframe and the new image should come from y=0 and should stop at point y=329-32 because my image height is of 32 , and it should lie on the old image and both the images should appear ,could u help me out of this problem
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-27-2008, 10:42 PM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Heredia, Costa Rica
Posts: 2,223
Norm is on a distinguished road
What is your code doing that is incorrect? Does it show the two images but not move them or what?
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-09-2008, 05:13 PM
Member
 
Join Date: Jul 2008
Posts: 2
prasad_bbs2004 is on a distinguished road
Hello all
Hi this is prasad. i have joined recently and i just want to say hello to every one
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 07-09-2008, 07:14 PM
Niveditha's Avatar
Senior Member
 
Join Date: May 2008
Posts: 299
Niveditha is on a distinguished road
Send a message via Skype™ to Niveditha
Hello Prasad,
Welcome to our Forum...
You are in a wrong place to say "HI"..

Post it in a new thread...
__________________
To finish sooner, take your own time....
Nivedithaaaa
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 07-10-2008, 09:46 AM
Member
 
Join Date: Jul 2008
Posts: 2
prasad_bbs2004 is on a distinguished road
thanks for the mail
Hi Niveditha,

Thanks for the information, i will post my hello message in a new thread.

Bye,
prasad.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Nqueens with threads Zosden Advanced Java 3 06-20-2008 10:29 PM
Threads! rameshraj Advanced Java 1 05-04-2008 06:11 PM
Using threads Java Tip Java Tips 0 12-11-2007 12:25 PM
Threads one198 Threads and Synchronization 1 11-20-2007 08:15 PM
Server n threads ferosh Networking 2 04-29-2007 12:42 AM


All times are GMT +3. The time now is 08:04 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org