當前位置: 首頁>>代碼示例>>Java>>正文


Java Duration.seconds方法代碼示例

本文整理匯總了Java中javafx.util.Duration.seconds方法的典型用法代碼示例。如果您正苦於以下問題:Java Duration.seconds方法的具體用法?Java Duration.seconds怎麽用?Java Duration.seconds使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.util.Duration的用法示例。


在下文中一共展示了Duration.seconds方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: Exe

import javafx.util.Duration; //導入方法依賴的package包/類
void Exe(int i) {
    if(i==1) {
        warnmesse="プレイ開始から5分経過しました\n混雑している場合は次の人に\n交代してください";
        fontsize=25;
    }else if(i==2) {
        warnmesse="プレイ開始から10分経過しました\n混雑している場合は次の人に\n交代してください";
        fontsize=25;
    }else if(i==-1) {
    	warnmesse="user timer is reset";
    	fontsize=35;
    }

    final Stage primaryStage = new Stage(StageStyle.TRANSPARENT);
    primaryStage.initModality(Modality.NONE);
    final StackPane root = new StackPane();

    final Scene scene = new Scene(root, 350, 140);
    scene.setFill(null);

    final Label label = new Label(warnmesse);
    label.setFont(new Font("Arial", fontsize));
    BorderPane borderPane = new BorderPane();
    borderPane.setCenter(label);
    borderPane.setStyle("-fx-background-radius: 10;-fx-background-color: rgba(0,0,0,0.3);");

    root.getChildren().add(borderPane);

    final Rectangle2D d = Screen.getPrimary().getVisualBounds();
    primaryStage.setScene(scene);
    primaryStage.setAlwaysOnTop(true);
    primaryStage.setX(d.getWidth()-350);
    primaryStage.setY(d.getHeight()-300);

    primaryStage.show();

    final Timeline timer = new Timeline(new KeyFrame(Duration.seconds(CLOSE_SECONDS), (ActionEvent event) -> primaryStage.close()));
    timer.setCycleCount(Timeline.INDEFINITE);
    timer.play();
}
 
開發者ID:chrootRISCassembler,項目名稱:CapsLock,代碼行數:40,代碼來源:OverLayWindow.java

示例2: keyPressedAnimation

import javafx.util.Duration; //導入方法依賴的package包/類
/**
 * Animation for key pressed.
 * @param b 
 */
private void keyPressedAnimation(Button b) {
	ScaleTransition st = new ScaleTransition(Duration.seconds(.2), b);
	st.setFromX(.8);
	st.setFromY(.8);
	st.setToX(1.6);
	st.setToY(1.6);
	st.play();
	st.setOnFinished(e -> {
		if(!b.isHover()) {
			ScaleTransition st2 = new ScaleTransition(Duration.seconds(.09), b);
			st2.setToX(1);
			st2.setToY(1);
			st2.play();
		}
	});
	
	FadeTransition ft = new FadeTransition(Duration.seconds(.2), b);
	ft.setFromValue(.2);
	ft.setToValue(1);
	ft.play();	
}
 
開發者ID:ShekkarRaee,項目名稱:xpanderfx,代碼行數:26,代碼來源:MainFXMLDocumentController.java

示例3: startAnimateForm300

import javafx.util.Duration; //導入方法依賴的package包/類
private Timeline startAnimateForm300() {
    Timeline tml = new Timeline(
            new KeyFrame(Duration.ZERO, new KeyValue(pnlContent.maxHeightProperty(), 70)),
            new KeyFrame(Duration.seconds(0.4), new KeyValue(pnlContent.maxHeightProperty(), 300, Interpolator.EASE_BOTH)));
    tml.setOnFinished((ActionEvent event) -> {
        pnlForm.setVisible(true);
        txtSend.requestFocus();
    });
    return tml;
}
 
開發者ID:RestComm,項目名稱:phone-simulator,代碼行數:11,代碼來源:USSDGUIController.java

示例4: rotateHer

import javafx.util.Duration; //導入方法依賴的package包/類
public void rotateHer(Label labelHer, ImageView iv)
{
	RotateTransition rotation = new RotateTransition(Duration.seconds(2), iv);
	rotation.setCycleCount(Animation.INDEFINITE);
	rotation.setByAngle(360);

	iv.setTranslateZ(iv.getBoundsInLocal().getWidth() / 2.0);
	iv.setRotationAxis(Rotate.Y_AXIS);
	
	labelHer.setOnMouseEntered(e ->
	{ 
		rotation.play();
		iv.setRotate(180);
	});
	labelHer.setOnMouseExited(e ->
	{ 
		rotation.pause();
		iv.setRotate(0);
	});
}
 
開發者ID:mikemacharia39,項目名稱:gatepass,代碼行數:21,代碼來源:MainWindow.java

示例5: periodicallyStrikeRandomNodes

import javafx.util.Duration; //導入方法依賴的package包/類
private void periodicallyStrikeRandomNodes(TilePane field) {
    Timeline timeline = new Timeline(new KeyFrame(Duration.seconds(0), event -> strikeRandomNode(field)),
            new KeyFrame(Duration.seconds(2)));

    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.play();
}
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:8,代碼來源:LightningSimulator.java

示例6: initializeTimeline

import javafx.util.Duration; //導入方法依賴的package包/類
private void initializeTimeline () {
    Timeline timeline = getTimeline();
    Duration frameDuration = Duration.seconds(1.0d / FPS);
    KeyFrame repeatedFrame = new KeyFrame(frameDuration, e -> step(frameDuration));
    timeline.getKeyFrames().add(repeatedFrame);
    timeline.setCycleCount(Animation.INDEFINITE);
    timeline.play();
}
 
開發者ID:tomrom95,項目名稱:GameAuthoringEnvironment,代碼行數:9,代碼來源:GameEngine.java

示例7: configureBox

import javafx.util.Duration; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private void configureBox(HBox root) {
	StackPane container = new StackPane();
	//container.setPrefHeight(700);
	container.setPrefSize(boxBounds.getWidth(), boxBounds.getHeight());
	container.setStyle("-fx-border-width:1px;-fx-border-style:solid;-fx-border-color:#999999;");

	table= new TableView<AttClass>();
	Label lview= new Label();
	lview.setText("View Records");
	lview.setId("lview");
	bottomPane= new VBox();

	tclock= new Text(); 
	tclock.setId("lview");
	//tclock.setFont(Font.font("Calibri", 20));
	final Timeline timeline = new Timeline(new KeyFrame(Duration.seconds(1), new EventHandler<ActionEvent>() {  
		@Override  
		public void handle(ActionEvent event) {  
			tclock.setText(DateFormat.getDateTimeInstance().format(new Date()));
		}  
	}));  
	timeline.setCycleCount(Animation.INDEFINITE);  
	timeline.play();

	bottomPane.getChildren().addAll(tclock,lview);
	bottomPane.setAlignment(Pos.CENTER);

	//table pane
	namecol= new TableColumn<>("First Name");
	namecol.setMinWidth(170);
	namecol.setCellValueFactory(new PropertyValueFactory<>("name"));

	admcol= new TableColumn<>("Identication No.");
	admcol.setMinWidth(180);
	admcol.setCellValueFactory(new PropertyValueFactory<>("adm"));

	typecol= new TableColumn<>("Type");
	typecol.setMinWidth(130);
	typecol.setCellValueFactory(new PropertyValueFactory<>("type"));

	timecol= new TableColumn<>("Signin");
	timecol.setMinWidth(140);
	timecol.setCellValueFactory(new PropertyValueFactory<>("timein"));

	datecol= new TableColumn<>("Date");
	datecol.setMinWidth(180);
	datecol.setCellValueFactory(new PropertyValueFactory<>("date"));

	table.getColumns().addAll(namecol, admcol, typecol, timecol, datecol);
	table.setItems(getAtt());
	att= getAtt();
	table.setItems(FXCollections.observableArrayList(att));
	table.setMinHeight(500);

	btnrefresh = new Button("Refresh");
	btnrefresh.setOnAction(new EventHandler<ActionEvent>() {
		public void handle(ActionEvent t) {
			table.setItems(getAtt());
		}
	});
	laytable= new VBox(10);
	laytable.getChildren().addAll(table, btnrefresh);
	laytable.setAlignment(Pos.TOP_LEFT);

	container.getChildren().addAll(bottomPane,laytable);
	setAnimation();
	sc.setContent(container);
	root.setStyle("-fx-background-color: linear-gradient(#E4EAA2, #9CD672)");
	root.getChildren().addAll(getActionPane(),sc);

	//service.start();
}
 
開發者ID:mikemacharia39,項目名稱:gatepass,代碼行數:74,代碼來源:AllAttendance.java

示例8: showAllCurrentStatus

import javafx.util.Duration; //導入方法依賴的package包/類
private void showAllCurrentStatus() {

		final Timeline status = new Timeline(
				new KeyFrame(Duration.seconds(0),
						new EventHandler<ActionEvent>() {
					@Override public void handle(ActionEvent actionEvent) {
						showBalanceStatus(currentBalanceStatus());
					}
				}
						),
				new KeyFrame(Duration.seconds(3))
				);
		status.setCycleCount(Animation.INDEFINITE);
		status.play();
	}
 
開發者ID:krHasan,項目名稱:Money-Manager,代碼行數:16,代碼來源:DashboardController.java

示例9: oakyButtonHandler

import javafx.util.Duration; //導入方法依賴的package包/類
public void oakyButtonHandler(MouseEvent event, Popup pp) {
	ScaleTransition st = new ScaleTransition(Duration.seconds(.3), (Node) pp.getContent());
	st.setToX(0);
	st.play();
	
	FadeTransition fd = new FadeTransition(Duration.seconds(.3), (Node) pp.getContent());
	fd.setToValue(.2);
	st.setOnFinished(e -> pp.hide());
}
 
開發者ID:ShekkarRaee,項目名稱:xpanderfx,代碼行數:10,代碼來源:AboutFXMLDocumentController.java

示例10: buttonHovered

import javafx.util.Duration; //導入方法依賴的package包/類
/**
 * 
 * @param b 
 */
public void buttonHovered(Button b) {
	ScaleTransition st = new ScaleTransition(Duration.seconds(.2), b);
	st.setToX(1.6);
	st.setToY(1.6);
	st.play();		
}
 
開發者ID:ShekkarRaee,項目名稱:xpanderfx,代碼行數:11,代碼來源:MainFXMLDocumentController.java

示例11: animateMovinement

import javafx.util.Duration; //導入方法依賴的package包/類
/**
 * 
 * @param direction
 * @param from
 * @param to 
 */
private synchronized void animateMovinement(Direction direction, Tile from, Tile to) {
	TranslateTransition st = new TranslateTransition(Duration.seconds(.3), from);
	st.setFromX(0);
	st.setToX(direction.getX_location());
	st.play();
	st.setOnFinished(e -> {
		to.combine(from);
		this.checkCompletion(to);
		from.remove();
	});
}
 
開發者ID:ShekkarRaee,項目名稱:xpanderfx,代碼行數:18,代碼來源:MainFXMLDocumentController.java

示例12: AnimatedPopup

import javafx.util.Duration; //導入方法依賴的package包/類
private AnimatedPopup() {

            showFadeTransition = new FadeTransition(Duration.seconds(0.2), getScene().getRoot());
            showFadeTransition.setFromValue(0);
            showFadeTransition.setToValue(1);
            showFadeTransition.setInterpolator(new BackInterpolator());

            showScaleTransition = new ScaleTransition(Duration.seconds(0.2), getScene().getRoot());
            showScaleTransition.setFromX(0.8);
            showScaleTransition.setFromY(0.8);
            showScaleTransition.setToY(1);
            showScaleTransition.setToX(1);

            showScaleTransition.setInterpolator(new BackInterpolator());

            hideFadeTransition = new FadeTransition(Duration.seconds(.3), getScene().getRoot());
            hideFadeTransition.setFromValue(1);
            hideFadeTransition.setToValue(0);
            hideFadeTransition.setInterpolator(new BackInterpolator());

            hideScaleTransition = new ScaleTransition(Duration.seconds(.3), getScene().getRoot());
            hideScaleTransition.setFromX(1);
            hideScaleTransition.setFromY(1);
            hideScaleTransition.setToY(0.8);
            hideScaleTransition.setToX(0.8);

            hideScaleTransition.setInterpolator(new BackInterpolator());
            hideScaleTransition.setOnFinished(new EventHandler<ActionEvent>() {
                @Override
                public void handle(ActionEvent actionEvent) {
                    if (AnimatedPopup.super.isShowing()) {
                        AnimatedPopup.super.hide();
                    }
                }
            });
        }
 
開發者ID:scourgemancer,項目名稱:graphing-loan-analyzer,代碼行數:37,代碼來源:DatePickerSkin.java

示例13: popupCloser

import javafx.util.Duration; //導入方法依賴的package包/類
/**
 * 
 * @param pp 
 */
private void popupCloser(Popup pp, Node node) {		
	ScaleTransition st = new ScaleTransition(Duration.seconds(.3), node);
	st.setToX(0);
	st.setToY(0);
	st.play();
	
	FadeTransition fd = new FadeTransition(Duration.seconds(.3), node);
	fd.setToValue(.2);
	fd.play();
	st.setOnFinished(e -> pp.hide());
}
 
開發者ID:ShekkarRaee,項目名稱:xpanderfx,代碼行數:16,代碼來源:MainFXMLDocumentController.java

示例14: createBlinker

import javafx.util.Duration; //導入方法依賴的package包/類
private Timeline createBlinker(Node node) {
    Timeline blink = new Timeline(
            new KeyFrame(
                    Duration.seconds(0),
                    new KeyValue(
                            node.opacityProperty(),
                            1,
                            Interpolator.DISCRETE
                    )
            ),
            new KeyFrame(
                    Duration.seconds(0.35),
                    new KeyValue(
                            node.opacityProperty(),
                            0,
                            Interpolator.DISCRETE
                    )
            ),
            new KeyFrame(
                    Duration.seconds(0.7),
                    new KeyValue(
                            node.opacityProperty(),
                            1,
                            Interpolator.DISCRETE
                    )
            )
    );
    blink.setCycleCount(Animation.INDEFINITE);

    return blink;
}
 
開發者ID:Moccko,項目名稱:campingsimulator2017,代碼行數:32,代碼來源:HomeView.java

示例15: start

import javafx.util.Duration; //導入方法依賴的package包/類
public void start(Stage stage) throws IOException 
{

    Timeline timeline = new Timeline();
    DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
    Date date = new Date();

    timeline = new Timeline
    (
        new KeyFrame(Duration.seconds(0),
        new EventHandler<ActionEvent>() 
        {
                public void handle(ActionEvent actionEvent) 
                {
                    Date date = new Date();
                    Format formatter = new SimpleDateFormat("HH:mm:ss");
                    String inp = "17:46:52";
                    
                    if(formatter.format(date).equals(inp))
                    {
                        mySound = "text.mp3";
                        media = new Media(new File(mySound).toURI().toString());
                        mediaPlayer = new MediaPlayer(media);
                        mediaPlayer.play();
                    }  
                }
        }
    ),
    new KeyFrame(Duration.seconds(1))
    );
    timeline.setCycleCount(Animation.INDEFINITE);
    timeline.play();
    }
 
開發者ID:ksg14,項目名稱:duncan,代碼行數:34,代碼來源:alarmScheduler.java


注:本文中的javafx.util.Duration.seconds方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。