Monday, September 20, 2010

CrazyEngineers Forum - Computer Science & IT Engineering

CrazyEngineers Forum - Computer Science & IT Engineering


how to make button move in a sigle row

Posted: 19 Sep 2010 10:51 AM PDT

Quote:


import java.awt.*;
import java.applet.*;


public class fi extends Applet implements Runnable
{
Button b[] = new Button[1];
int x1=0;
Thread t;
public void init()
{
for(int i=0;i<1;i++)
{
setLayout(new FlowLayout());
b[i] = new Button();
add(b[i]);
}
}
public void start()
{
t = new Thread(this);
t.start();
}
public void run()
{
Thread t1=Thread.currentThread();
while(t==t1)
{

try
{
repaint();
Thread.sleep(1000);
setBackground(Color.blue);
}
catch(Exception e){}
}
}
public void paint(Graphics g)
{
for (int j=0;j<1;j++)
{
b[j].setSize(15,6);
x1=(x1+3)%200;
b[j].setLocation(x1,100);
}

}
}
/*<applet code="fi.class" width="300" height="400"></applet>*/

Here is my code for moving button in a single row , but the problem i m facing is that it is moving very fast i want that to move per second means button move forward after each second...
Is this my code correct or need some more implementation or us there any another way to approach this...

Is that is the virus?

Posted: 19 Sep 2010 09:52 AM PDT

Hi friends!! i got to ask some doubts.Let me ask now.
Whenever i open a word file another word file is created as ~$file name.When i close the word file the another wordfile which was created also closes..i tried to open the another word file keeping the first file opened it says the file cannot be opened coz there are some problems with the contents..Is that is the virus?y the another word file is created whenever i open a word file?

HUB Vs Star

Posted: 19 Sep 2010 06:15 AM PDT

Hey Friends,

Please help me in deciding which network to use at my Home Group.

Give me your suggestion Please.

Regards,
Vipul

No comments:

Post a Comment