Difference between revisions of "Scratch"

From MyWiki
Jump to: navigation, search
Line 4: Line 4:
  
 
yum install gcc-c++
 
yum install gcc-c++
 +
 +
 +
import java.util.Timer;
 +
import java.util.TimerTask;
 +
import java.awt.*;
 +
 +
public class ToDo extends Frame {
 +
  Timer timer;
 +
  Panel panel;
 +
 +
  public ToDo ( int seconds ) 
 +
  {
 +
  setBounds(100,100,100,100);
 +
  setVisible(true);
 +
  panel= new Panel();
 +
  add(panel);
 +
    timer = new Timer (  ) ;
 +
    timer.schedule ( new ToDoTask (  ) ,10, seconds*1000 ) ;
 +
  }
 +
 
 +
    public void paint(Graphics g) {
 +
//setColor(Color.BLACK);
 +
  // g.drawText(25, 25, "asdf");
 +
 
 +
  }
 +
 +
 +
  class ToDoTask extends TimerTask
 +
  {
 +
    public void run (  )  {
 +
                          System.out.println ( "OK, It's time to do something!" );
 +
                          setBounds(200,200,200,200) ;
 +
                          repaint();
 +
 +
                          //  timer.cancel (  ) ; //Terminate the thread
 +
                          }
 +
  }
 +
 +
 +
  public static void main ( String[] args )  {
 +
    System.out.println ( "Schedule something to do in 5 seconds." ) ;
 +
    new ToDo ( 5 ) ;
 +
   
 +
   
 +
    System.out.println ( "Waiting." ) ;
 +
  }
 +
}

Revision as of 14:58, 27 July 2015

http://crackednoodle.com/2013/01/blu-ray-ripping-on-fedora-18/

yum install *fmpeg-devel*

yum install gcc-c++


import java.util.Timer; import java.util.TimerTask; import java.awt.*;

public class ToDo extends Frame {

 Timer timer;
 Panel panel;
 public ToDo ( int seconds )  
  {

setBounds(100,100,100,100); setVisible(true); panel= new Panel(); add(panel);

   timer = new Timer (  ) ;
   timer.schedule ( new ToDoTask (  ) ,10, seconds*1000 ) ;
  }
  
   public void paint(Graphics g) {

//setColor(Color.BLACK);

  // g.drawText(25, 25, "asdf");
 
 }


 class ToDoTask extends TimerTask 
  {
   public void run (  )   {
                          System.out.println ( "OK, It's time to do something!" );
                          setBounds(200,200,200,200) ;
                          repaint();

                          //  timer.cancel (  ) ; //Terminate the thread
                          }
  }


 public static void main ( String[] args )   {
   System.out.println ( "Schedule something to do in 5 seconds." ) ;
   new ToDo ( 5 ) ;
   
   
   System.out.println ( "Waiting." ) ;
 }

}