List of usage examples for javafx.scene.control Button setStyle
public final void setStyle(String value)
From source file:main.TestManager.java
/** * Displays given test. Intended for testing and * evaluating correct answers. (student mode only) * @param test test to display//from w w w .j a v a 2 s . co m * @param stage */ public static void displayTest(Test test, Stage stage) { Debugger.println(test.getName() + " - is displayed."); TabPane tabPane = new TabPane(); int counter = 1; for (Question q : test.getQuestions()) { Label instruction = new Label(q.question); instruction.setStyle("-fx-font-size: 20"); Pane choices = q.getPaneOfChoices(); VBox vbox = new VBox(instruction, choices); vbox.setSpacing(10); Tab tab = new Tab("Otzka " + Integer.toString(counter), vbox); tab.setStyle("-fx-font-size: 20"); tabPane.getTabs().add(tab); counter++; } Button finish = new Button("Ukon?i test!"); finish.setStyle("-fx-font-size: 20"); finish.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { try { test.evaluate(stage); } catch (IOException e) { Alert alert = new Alert(AlertType.ERROR); alert.setContentText("Ojoj, vyskytol sa problm. Aplikcia sa mus ukon?i."); alert.showAndWait(); System.exit(0); } } }); Button nextQuestion = new Button("alia"); nextQuestion.setStyle("-fx-font-size: 20"); nextQuestion.setOnAction(e -> tabPane.getSelectionModel().selectNext()); HBox buttons = new HBox(finish, nextQuestion); buttons.setSpacing(10); buttons.setAlignment(Pos.BOTTOM_CENTER); VBox outerVBox = new VBox(tabPane, buttons); outerVBox.setPadding(new Insets(10, 10, 10, 10)); Scene scene = new Scene(outerVBox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { Group group = new Group(); Button button = new Button("Button"); button.setStyle("-fx-font-size: 14px;"); group.getChildren().add(button);//from w w w . jav a2 s . co m Scene scene = new Scene(group, 300, 200); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { Group group = new Group(); Button button = new Button("Button"); button.setStyle("-fx-padding: 10 20 10 20;"); group.getChildren().add(button);// www.ja v a 2 s .c o m Scene scene = new Scene(group, 300, 200); primaryStage.setScene(scene); primaryStage.show(); }
From source file:photobooth.views.EmailPane.java
private void addXButton() { Button button = new Button(); try {/*from ww w . ja v a 2 s .com*/ button.setGraphic( new ImageView(new Image(getClass().getResource("/photobooth/images/exit.png").openStream()))); } catch (IOException ex) { Logger.getLogger(EmailPane.class.getName()).log(Level.SEVERE, null, ex); } button.setStyle("-fx-background-color: transparent;"); button.setLayoutX(730); button.setLayoutY(10); button.setMaxSize(50, 50); button.setMinSize(50, 50); button.getStyleClass().add("blueButton"); this.getChildren().add(button); button.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { t.cancel(); t.purge(); Global.getInstance().setSceneRoot(HomePane.getInstance()); } }); }
From source file:photobooth.views.ExplorerPane.java
private void addXButton() throws IOException { Button button = new Button(); button.setGraphic(/*from w w w. java 2 s.c o m*/ new ImageView(new Image(getClass().getResource("/photobooth/images/exit.png").openStream()))); button.setStyle("-fx-background-color: transparent;"); button.setLayoutX(730); button.setLayoutY(10); button.setMaxSize(50, 50); button.setMinSize(50, 50); button.getStyleClass().add("blueButton"); this.getChildren().add(button); button.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { Global.getInstance().setSceneRoot(HomePane.getInstance()); } }); }
From source file:photobooth.views.ExplorerPane.java
private void addUpButton() throws IOException { Button button = new Button(); button.setGraphic(//from w w w . ja v a 2s .c o m new ImageView(new Image(getClass().getResource("/photobooth/images/up.png").openStream()))); button.setStyle("-fx-background-color: transparent;"); button.setMaxSize(50, 50); button.setMinSize(50, 50); button.setLayoutX(120); button.setLayoutY(10); this.getChildren().add(button); button.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { Global.getInstance().setSceneRoot(LoadingPane.getInstance()); Platform.runLater(() -> { new Thread(new Runnable() { @Override public void run() { ExplorerPane.getInstance().setDir(new File(dir).getParentFile().getAbsolutePath(), 0, limit, directoryLevel - 1); Global.getInstance().setSceneRoot(ExplorerPane.getInstance()); } }).start(); }); } }); }
From source file:photobooth.views.ExplorerPane.java
private void addNextButton() throws IOException { Button button = new Button(); button.setGraphic(/*from w w w. j a v a 2 s.c o m*/ new ImageView(new Image(getClass().getResource("/photobooth/images/next.png").openStream()))); button.setStyle("-fx-background-radius: 50%; "); button.setStyle("-fx-background-color: transparent;"); button.setLayoutX(740); button.setLayoutY(220); button.setMaxSize(50, 50); button.setMinSize(50, 50); this.getChildren().add(button); button.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { Global.getInstance().setSceneRoot(LoadingPane.getInstance()); Platform.runLater(() -> { new Thread(new Runnable() { @Override public void run() { ExplorerPane.getInstance().setDir(dir, offset + limit, limit, directoryLevel); Global.getInstance().setSceneRoot(ExplorerPane.getInstance()); } }).start(); }); } }); }
From source file:photobooth.views.ExplorerPane.java
private void addPrevButton() throws IOException { Button button = new Button(); button.setGraphic(/* w w w.j ava 2 s .c om*/ new ImageView(new Image(getClass().getResource("/photobooth/images/prev.png").openStream()))); button.setStyle("-fx-background-radius: 50%; "); button.setStyle("-fx-background-color: transparent;"); button.setLayoutX(10); button.setLayoutY(220); button.setMaxSize(50, 50); button.setMinSize(50, 50); this.getChildren().add(button); button.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { Global.getInstance().setSceneRoot(LoadingPane.getInstance()); Platform.runLater(() -> { new Thread(new Runnable() { @Override public void run() { ExplorerPane.getInstance().setDir(dir, offset - limit, limit, directoryLevel); Global.getInstance().setSceneRoot(ExplorerPane.getInstance()); } }).start(); }); } }); }
From source file:vkmanager.controller.PhotosDetailedController.java
public void showPhotosFromAlbum(VKPhotoAlbum album, int userId) { this.album = album; idForDownload = album.getId();/*from w w w . j a va2s . co m*/ albumDescription.setText(album.getDescription()); photos = vkapi.getPhotosFromAlbum(idForDownload, userId); int i = 0; int j = 0; gridPaneDetailed.addRow(0); for (VKPhoto photo : photos) { Image photoThumbLink = new Image(photo.getLink_s()); ImageView photoThumb = new ImageView(photoThumbLink); photoThumb.setFitHeight(160); photoThumb.setFitWidth(240); photoThumb.setPreserveRatio(true); photoThumb.setSmooth(true); photoThumb.setCache(true); Button photoButt = new Button(); photoButt.setGraphic(photoThumb); photoButt.setStyle("-fx-background-color: white;"); photoButt.setMinSize(240, 160); photoButt.setAlignment(Pos.CENTER); BorderPane bp = new BorderPane(null, photoButt, null, null, null); gridPaneDetailed.add(bp, j, i); j++; if (j == 3) { i++; j = 0; gridPaneDetailed.addRow(i); } } }