本文整理汇总了Java中javafx.animation.PauseTransition.setOnFinished方法的典型用法代码示例。如果您正苦于以下问题:Java PauseTransition.setOnFinished方法的具体用法?Java PauseTransition.setOnFinished怎么用?Java PauseTransition.setOnFinished使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.animation.PauseTransition
的用法示例。
在下文中一共展示了PauseTransition.setOnFinished方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addContinuousPressHandler
import javafx.animation.PauseTransition; //导入方法依赖的package包/类
/**
* Add an event handler to a node will trigger continuously trigger at a given interval while the button is
* being pressed.
*
* @param node the {@link Node}
* @param holdTime interval time
* @param handler the handler
*/
private void addContinuousPressHandler(final Node node, final Duration holdTime,
final EventHandler<MouseEvent> handler) {
final Wrapper<MouseEvent> eventWrapper = new Wrapper<>();
final PauseTransition holdTimer = new PauseTransition(holdTime);
holdTimer.setOnFinished(event -> {
handler.handle(eventWrapper.content);
holdTimer.playFromStart();
});
node.addEventHandler(MouseEvent.MOUSE_PRESSED, event -> {
eventWrapper.content = event;
holdTimer.playFromStart();
});
node.addEventHandler(MouseEvent.MOUSE_RELEASED, event -> holdTimer.stop());
node.addEventHandler(MouseEvent.DRAG_DETECTED, event -> holdTimer.stop());
}
示例2: regionOrProductChanged
import javafx.animation.PauseTransition; //导入方法依赖的package包/类
public void regionOrProductChanged() {
cancel();
boolean regionChanged = updateRegionAndProductSelection();
if (regionChanged) {
// pause the data updating to wait for animation to finish
PauseTransition delay = new PauseTransition(Duration.millis(1500));
delay.setOnFinished(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent t) {
restart();
}
});
delay.play();
} else {
restart();
}
}
示例3: initialize
import javafx.animation.PauseTransition; //导入方法依赖的package包/类
@Override
public void initialize(URL location, ResourceBundle resources) {
tableColumnScope.setCellValueFactory(new PropertyValueFactory<>("scope"));
tableColumnIdentifier.setCellValueFactory(new PropertyValueFactory<>("identifier"));
tableColumnParameter.setCellValueFactory(new PropertyValueFactory<>("parameter"));
tableColumnType.setCellValueFactory(new PropertyValueFactory<>("type"));
tableColumnValue.setCellValueFactory(new PropertyValueFactory<>("data"));
PauseTransition refreshLoop = new PauseTransition();
refreshLoop.setOnFinished(e -> {
if (toggleButtonRefresh.isSelected())
refresh();
refreshLoop.playFromStart();
});
refreshLoop.setDuration(Duration.seconds(0.5));
refreshLoop.playFromStart();
refresh();
}
示例4: onCloseRequest
import javafx.animation.PauseTransition; //导入方法依赖的package包/类
private void onCloseRequest() {
final char borderSign = Properties.getPropertyForTestdataApplication(KEY__TESTDATA_APPLICATION__BORDER_SIGN).charAt(0);
final String message = Properties.getPropertyForTestdataApplication(KEY__TESTDATA_APPLICATION__MESSAGE_STOP);
final String title = Properties.getPropertyForTestdataApplication(KEY__TESTDATA_APPLICATION__TITLE);
LoggerFacade.getDefault().message(borderSign, 80, message + title);
try {
TestdataFacade.getDefault().shutdown();
} catch (InterruptedException e) {
}
Injector.forgetAll();
DatabaseFacade.getDefault().shutdown();
final PauseTransition pt = new PauseTransition(LITTLE_DELAY__DURATION_125);
pt.setOnFinished((ActionEvent event) -> {
Platform.exit();
});
pt.playFromStart();
}
示例5: onCloseRequest
import javafx.animation.PauseTransition; //导入方法依赖的package包/类
private void onCloseRequest() {
// afterburner.fx
Injector.forgetAll();
// Database
DatabaseFacade.getDefault().shutdown();
// Message
final char borderSign = Properties.getPropertyForApplication(KEY__APPLICATION__BORDER_SIGN).charAt(0);
final String message = Properties.getPropertyForApplication(KEY__APPLICATION__MESSAGE_STOP);
final String title = Properties.getPropertyForApplication(KEY__APPLICATION__TITLE)
+ Properties.getPropertyForApplication(KEY__APPLICATION__VERSION);
LoggerFacade.getDefault().message(borderSign, 80, String.format(message, title));
// Timer
final PauseTransition pt = new PauseTransition(LITTLE_DELAY__DURATION_125);
pt.setOnFinished((ActionEvent event) -> {
Platform.exit();
});
pt.playFromStart();
}
示例6: onCloseRequest
import javafx.animation.PauseTransition; //导入方法依赖的package包/类
private void onCloseRequest() {
// afterburner.fx
Injector.forgetAll();
// Database
DatabaseFacade.INSTANCE.shutdown();
// Message
final char borderSign = this.getProperty(KEY__APPLICATION__BORDER_SIGN).charAt(0);
final String message = this.getProperty(KEY__APPLICATION__MESSAGE_STOP);
final String title = this.getProperty(KEY__APPLICATION__TITLE);
LoggerFacade.INSTANCE.message(borderSign, 80, String.format(message, title));
// Timer
final PauseTransition pt = new PauseTransition(DURATION__125);
pt.setOnFinished((ActionEvent event) -> {
Platform.exit();
});
pt.playFromStart();
}
示例7: onCloseRequest
import javafx.animation.PauseTransition; //导入方法依赖的package包/类
private void onCloseRequest() {
// afterburner.fx
Injector.forgetAll();
// Database
DatabaseFacade.getDefault().shutdown();
// Message
final char borderSign = this.getProperty(KEY__APPLICATION__BORDER_SIGN).charAt(0);
final String message = this.getProperty(KEY__APPLICATION__MESSAGE_STOP);
final String title = this.getProperty(KEY__APPLICATION__TITLE) + this.getProperty(KEY__APPLICATION__VERSION);
LoggerFacade.getDefault().message(borderSign, 80, String.format(message, title));
// Timer
final PauseTransition pt = new PauseTransition(DURATION__125);
pt.setOnFinished((ActionEvent event) -> {
Platform.exit();
});
pt.playFromStart();
}
示例8: onActionShowPageCSS
import javafx.animation.PauseTransition; //导入方法依赖的package包/类
private void onActionShowPageCSS(ConcreteSample concreteSample) {
LoggerFacade.getDefault().debug(this.getClass(), "On action show page [CSS]"); // NOI18N
final PauseTransition pt = new PauseTransition();
pt.setDuration(Duration.millis(25.0d));
pt.setOnFinished(event -> {
LoggerFacade.getDefault().debug(this.getClass(), "Load css-url..."); // NOI18N
final boolean hasCssURL = concreteSample.hasCssURL();
if (hasCssURL) {
LoggerFacade.getDefault().debug(this.getClass(), "A css-url is defined."); // NOI18N
wvCssPage.getEngine().loadContent(TemplateLoader.loadCSStemplate(concreteSample.getCssURL().get()));
}
else {
LoggerFacade.getDefault().warn(this.getClass(), "No css-url is defined!"); // NOI18N
wvCssPage.getEngine().loadContent(TemplateLoader.loadNoXyURLisDefinedTemplate(TemplateLoader.UrlType.CSS));
}
});
pt.playFromStart();
}
示例9: onActionShowPageJavaDoc
import javafx.animation.PauseTransition; //导入方法依赖的package包/类
private void onActionShowPageJavaDoc(ConcreteSample concreteSample) {
LoggerFacade.getDefault().debug(this.getClass(), "On action show page [JavaDoc]"); // NOI18N
final PauseTransition pt = new PauseTransition();
pt.setDuration(Duration.millis(25.0d));
pt.setOnFinished(event -> {
LoggerFacade.getDefault().debug(this.getClass(), "Load javadoc-url..."); // NOI18N
final boolean hasJavaDocURL = concreteSample.hasJavaDocURL();
if (hasJavaDocURL) {
LoggerFacade.getDefault().debug(this.getClass(), "A javadoc-url is defined."); // NOI18N
wvJavaDocPage.getEngine().load(concreteSample.getJavaDocURL().get());
}
else {
LoggerFacade.getDefault().warn(this.getClass(), "No javadoc-url is defined!"); // NOI18N
wvJavaDocPage.getEngine().loadContent(TemplateLoader.loadNoXyURLisDefinedTemplate(TemplateLoader.UrlType.JAVA_DOC));
}
});
pt.playFromStart();
}
示例10: onActionShowPageOverview
import javafx.animation.PauseTransition; //导入方法依赖的package包/类
private void onActionShowPageOverview(ConcreteSample concreteSample) {
LoggerFacade.getDefault().debug(this.getClass(), "On action show page [Overview]"); // NOI18N
final PauseTransition pt = new PauseTransition();
pt.setDuration(Duration.millis(25.0d));
pt.setOnFinished(event -> {
LoggerFacade.getDefault().debug(this.getClass(), "Load overview-url..."); // NOI18N
final boolean hasOverviewURL = concreteSample.hasOverviewURL();
if (hasOverviewURL) {
LoggerFacade.getDefault().debug(this.getClass(), "A overview-url is defined."); // NOI18N
wvOverviewPage.getEngine().load(concreteSample.getOverviewURL().get());
}
else {
LoggerFacade.getDefault().warn(this.getClass(), "No overview-url is defined!"); // NOI18N
wvOverviewPage.getEngine().loadContent(TemplateLoader.loadNoXyURLisDefinedTemplate(TemplateLoader.UrlType.OVERVIEW));
}
});
pt.playFromStart();
}
示例11: onCloseRequest
import javafx.animation.PauseTransition; //导入方法依赖的package包/类
private void onCloseRequest() {
// afterburner.fx
Injector.forgetAll();
// Database
DatabaseFacade.INSTANCE.shutdown();
// Message
final char borderSign = this.getProperty(KEY__APPLICATION__BORDER_SIGN).charAt(0);
final String message = this.getProperty(KEY__APPLICATION__MESSAGE_STOP);
final String title = this.getProperty(KEY__APPLICATION__TITLE) + this.getProperty(KEY__APPLICATION__VERSION);
LoggerFacade.INSTANCE.message(borderSign, 80, String.format(message, title));
// Timer
final PauseTransition pt = new PauseTransition(DURATION__125);
pt.setOnFinished((ActionEvent event) -> {
Platform.exit();
});
pt.playFromStart();
}
示例12: onActionShowPageSourceCode
import javafx.animation.PauseTransition; //导入方法依赖的package包/类
private void onActionShowPageSourceCode(ConcreteSample concreteSample) {
LoggerFacade.getDefault().debug(this.getClass(), "On action show page [SourceCode]"); // NOI18N
final PauseTransition pt = new PauseTransition();
pt.setDuration(Duration.millis(25.0d));
pt.setOnFinished(event -> {
LoggerFacade.getDefault().debug(this.getClass(), "Load sourcecode-url..."); // NOI18N
final boolean hasCssURL = concreteSample.hasCssURL();
if (hasCssURL) {
LoggerFacade.getDefault().debug(this.getClass(), "A sourcecode-url is defined."); // NOI18N
wvSourceCodePage.getEngine().loadContent(TemplateLoader.loadSourceCodeTemplate(concreteSample.getSourceCodeURL().get()));
}
else {
LoggerFacade.getDefault().warn(this.getClass(), "No sourcecode-url is defined!"); // NOI18N
wvSourceCodePage.getEngine().loadContent(TemplateLoader.loadNoXyURLisDefinedTemplate(TemplateLoader.UrlType.SOURCE_CODE));
}
});
pt.playFromStart();
}
示例13: openNotification
import javafx.animation.PauseTransition; //导入方法依赖的package包/类
public static void openNotification(String text) {
Stage stage = new Stage();
stage.setWidth(300);
stage.setHeight(125);
Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
NotificationView notificationView = new NotificationView();
stage.setScene(new Scene(notificationView.getNotificationView(), 300, 125));
stage.setResizable(false);
stage.setAlwaysOnTop(true);
stage.setX(primaryScreenBounds.getMinX() + primaryScreenBounds.getWidth() - 300);
stage.setY(primaryScreenBounds.getMinY() + primaryScreenBounds.getHeight() - 125);
stage.initStyle(StageStyle.UNDECORATED);
notificationView.getNotificationText().setWrapText(true);
notificationView.getNotificationText().setAlignment(Pos.CENTER);
notificationView.getNotificationText().setPadding(new Insets(0, 5, 0, 20));
notificationView.getNotificationText().setText(text);
stage.show();
PauseTransition delay = new PauseTransition(Duration.seconds(5));
delay.setOnFinished(event -> stage.close());
delay.play();
}
示例14: makeNotification
import javafx.animation.PauseTransition; //导入方法依赖的package包/类
/**
* Create a new notification
* @param title The title for the window
* @param imagePath Path to the icon to be displayed
* @param message The message to display
*/
public static void makeNotification(String title, String imagePath, String message) {
PopUpWindow window = new PopUpWindow(height, width, xPosition, yPosition, title);
placement(true);
BorderPane pane = new BorderPane();
HBox box = new HBox();
box.setAlignment(Pos.CENTER);
box.setSpacing(12.0);
Label label = new Label(message);
pane.setCenter(box);
ImageView icon = new ImageView(imagePath);
icon.setPreserveRatio(true);
icon.setFitHeight(32.0);
box.getChildren().addAll(icon, label);
window.setContent(pane);
PopUpWindowManager.getInstance().addPopUpWindow(window);
PauseTransition delay = new PauseTransition(Duration.seconds(time));
delay.setOnFinished( event -> {PopUpWindowManager.getInstance().removePopUpWindow(window); placement(false);});
delay.play();
}
示例15: addPressAndHoldHandler
import javafx.animation.PauseTransition; //导入方法依赖的package包/类
public static void addPressAndHoldHandler(Node node, Duration holdTime,
EventHandler<MouseEvent> handler) {
class Wrapper<T> {
T content;
}
Wrapper<MouseEvent> eventWrapper = new Wrapper<>();
PauseTransition holdTimer = new PauseTransition(holdTime);
holdTimer.setOnFinished(event -> handler.handle(eventWrapper.content));
node.addEventHandler(MouseEvent.MOUSE_PRESSED, event -> {
eventWrapper.content = event;
holdTimer.playFromStart();
});
node.addEventHandler(MouseEvent.MOUSE_RELEASED, event -> holdTimer.stop());
node.addEventHandler(MouseEvent.DRAG_DETECTED, event -> holdTimer.stop());
}