import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.stage.Stage;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.layout.Pane;
import javafx.animation.*;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.util.Duration;
public class PROJETO extends Application {
private static Timeline videoTick;
static Stage stage;
static int k = 0;
Scene scene;
static Pane root = new Pane ( );
static Canvas canvas = new Canvas ( 660, 460 );
static GraphicsContext ctx = canvas.getGraphicsContext2D
( );
public static int Tempo_1 ( int t ) {
if ( t == 1 ){
ctx.setFill ( Color.BLUE );
ctx.fillText ( "1111111111", 225, 100 );
}
if ( t == 2 ){
ctx.setFill ( Color.BLUE );
ctx.fillText ( "2222222222", 225, 140 );
}
if ( t == 5 ){
ctx.setFill ( Color.BLUE );
ctx.fillText ( "3333333333", 225, 180 );
}
return 0;
}
//
//////////////////////////////////////////////////////////////////////////
public void start ( Stage stage ) throws InterruptedException {
ctx.setLineWidth ( 22.0 );
ctx.strokeRoundRect ( 10, 10, 640, 440, 10, 10 );
root.getChildren ( ).add ( canvas );
Scene scene = new Scene ( root );
stage.setTitle ( "CHAMADA DE
FUNÇÃO TEMPORIZADA AUTOMÁTICA" );
ctx.setFont ( Font.font ( "Arial", FontWeight.BOLD, 15 ) );
ctx.setFill ( Color.RED );
ctx.fillText ( "CHAMADA DE
FUNÇÃO TEMPORIZADA AUTOMÁTICA", 220, 60 );
stage.setScene ( scene );
stage.show ( );
Sleep ( 1000 );//um segundo
}
public static int Sleep ( int x ) {
do{
Duration duration = Duration.millis ( x );
videoTick = new Timeline ( new KeyFrame ( duration,
new EventHandler < ActionEvent > ( ) {
public void handle ( ActionEvent actionEvent ) {
System.out.println ( k );
k++;
if ( k == 4 )
System.exit ( 0 );
if ( k == 4 )
System.exit ( 0 );
Tempo_1 ( k );
}
} ) );
break;
}while ( true );
videoTick.setCycleCount ( Animation.INDEFINITE );
videoTick.playFromStart ( );
return 0;
}
//
//////////////////////////////////////////////////////////////////////////
public static void main ( String [ ] args ) {
Application.launch ( args );
}
}
Nenhum comentário:
Postar um comentário
Observação: somente um membro deste blog pode postar um comentário.