Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Runnable firstRun = new Runnable(){
- @Override
- public void run(){
- try{
- for (int x = 100; x <= 1024; x+=100) {
- graphics.setColor(Color.red);
- graphics.drawOval(x, 100, 200, 200);
- Thread.sleep(1000);
- graphics.setColor(Color.white);
- graphics.drawOval(x, 100, 200, 200);
- }
- }catch(InterruptedException ex){
- ex.printStackTrace();
- }
- }
- };
- Thread firstThread = new Thread(firstRun );
- Runnable secondRun= new Runnable(){
- @Override
- public void run(){
- try{
- for (int x = 100; x <= 1024; x+=100) {
- graphics.setColor(Color.red);
- graphics.drawOval(x, 100, 200, 200);
- Thread.sleep(1000);
- graphics.setColor(Color.white);
- graphics.drawOval(x, 100, 200, 200);
- }
- }catch(InterruptedException ex){
- ex.printStackTrace();
- }
- }
- };
- Thread secondThread = new Thread(secondRun);
- Runnable thirdRun= new Runnable(){
- @Override
- public void run(){
- try{
- for (int x = 100; x <= 1024; x+=100) {
- graphics.setColor(Color.red);
- graphics.drawOval(x, 100, 200, 200);
- Thread.sleep(1000);
- graphics.setColor(Color.white);
- graphics.drawOval(x, 100, 200, 200);
- }
- }catch(InterruptedException ex){
- ex.printStackTrace();
- }
- }
- };
- Thread thirdThread= new Thread(thirdRun);
- firstThread.start();
- secondThread.start();
- thirdThread.start();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement