本文整理汇总了Java中com.jfoenix.transitions.hamburger.HamburgerBasicCloseTransition类的典型用法代码示例。如果您正苦于以下问题:Java HamburgerBasicCloseTransition类的具体用法?Java HamburgerBasicCloseTransition怎么用?Java HamburgerBasicCloseTransition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HamburgerBasicCloseTransition类属于com.jfoenix.transitions.hamburger包,在下文中一共展示了HamburgerBasicCloseTransition类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import com.jfoenix.transitions.hamburger.HamburgerBasicCloseTransition; //导入依赖的package包/类
@Override
public void initialize(URL location, ResourceBundle resources) {
HamburgerSlideCloseTransition slideTransition = new HamburgerSlideCloseTransition(hamBurger1);
HamburgerBasicCloseTransition basicTransition = new HamburgerBasicCloseTransition(hamBurger2);
HamburgerBackArrowBasicTransition backTransition = new HamburgerBackArrowBasicTransition(hamBurger3);
HamburgerNextArrowBasicTransition nextTransition = new HamburgerNextArrowBasicTransition(hamBurger4);
backTransition.setRate(-1); //default look of hamburger.
basicTransition.setRate(-1);
slideTransition.setRate(-1);
nextTransition.setRate(-1);
hamBurger1.addEventHandler(MouseEvent.MOUSE_CLICKED,e ->{
slideTransition.setRate(slideTransition.getRate()*-1);
slideTransition.play();
});
hamBurger2.addEventHandler(MouseEvent.MOUSE_CLICKED,e ->{
basicTransition.setRate(basicTransition.getRate()*-1);
basicTransition.play();
});
hamBurger3.addEventHandler(MouseEvent.MOUSE_CLICKED,e ->{
backTransition.setRate(backTransition.getRate()*-1);
backTransition.play();
});
hamBurger4.addEventHandler(MouseEvent.MOUSE_CLICKED,e ->{
nextTransition.setRate(nextTransition.getRate()*-1);
nextTransition.play();
});
}
示例2: initialize
import com.jfoenix.transitions.hamburger.HamburgerBasicCloseTransition; //导入依赖的package包/类
@Override
public void initialize(URL location, ResourceBundle resources) {
loader = new FXMLLoader(getClass().getResource("../Drawer/drawer.fxml"));
try {
loader.load();
} catch (IOException e) {
}
drawerController = loader.getController();
drawerController.setTabPane(tabPane, borderPane);
drawer.setSidePane(drawerController.getDrawerPane());
burgerClose = new HamburgerBasicCloseTransition(hamburger);
burgerClose.setRate(1);
// hamburger.addEventHandler(MouseEvent.MOUSE_PRESSED, (e) -> {
// burgerClose.setRate(burgerClose.getRate() * 1);
// burgerClose.play();
//
// if (drawer.isShown()) {
// drawer.close();
// } else {
// drawer.open();
// }
//
// });
}
示例3: start
import com.jfoenix.transitions.hamburger.HamburgerBasicCloseTransition; //导入依赖的package包/类
@Override
public void start(Stage stage) {
FlowPane main = new FlowPane();
main.setVgap(20);
main.setHgap(20);
JFXHamburger h1 = new JFXHamburger();
HamburgerSlideCloseTransition burgerTask = new HamburgerSlideCloseTransition(h1);
burgerTask.setRate(-1);
h1.addEventHandler(MouseEvent.MOUSE_PRESSED, e -> {
burgerTask.setRate(burgerTask.getRate() * -1);
burgerTask.play();
});
JFXHamburger h2 = new JFXHamburger();
HamburgerBasicCloseTransition burgerTask1 = new HamburgerBasicCloseTransition(h2);
burgerTask1.setRate(-1);
h2.addEventHandler(MouseEvent.MOUSE_PRESSED, e -> {
burgerTask1.setRate(burgerTask1.getRate() * -1);
burgerTask1.play();
});
JFXHamburger h3 = new JFXHamburger();
HamburgerBackArrowBasicTransition burgerTask2 = new HamburgerBackArrowBasicTransition(h3);
burgerTask2.setRate(-1);
h3.addEventHandler(MouseEvent.MOUSE_PRESSED, e -> {
burgerTask2.setRate(burgerTask2.getRate() * -1);
burgerTask2.play();
});
JFXHamburger h4 = new JFXHamburger();
HamburgerNextArrowBasicTransition burgerTask3 = new HamburgerNextArrowBasicTransition(h4);
burgerTask3.setRate(-1);
h4.addEventHandler(MouseEvent.MOUSE_PRESSED, e -> {
burgerTask3.setRate(burgerTask3.getRate() * -1);
burgerTask3.play();
});
main.getChildren().add(h1);
main.getChildren().add(h2);
main.getChildren().add(h3);
main.getChildren().add(h4);
StackPane pane = new StackPane();
pane.getChildren().add(main);
StackPane.setMargin(main, new Insets(60));
pane.setStyle("-fx-background-color:WHITE");
final Scene scene = new Scene(pane, 400, 200);
scene.getStylesheets().add(HamburgerDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
stage.setTitle("JFX Burgers Demo :) ");
stage.setScene(scene);
stage.setResizable(false);
stage.show();
}