List of usage examples for javafx.scene.layout Pane setBackground
public final void setBackground(Background value)
From source file:ui.ChoseFonctionnalite.java
private void startClientMode(ActionEvent eventT) { //File config = new File("resource/config.json"); String host = ""; String port = "8000"; Stage stageModal = new Stage(); Pane root = new Pane(); root.setBackground(new Background(new BackgroundImage(new Image("resource/background.jpg"), BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.CENTER, new BackgroundSize(530, 400, true, true, true, true)))); stageModal.setScene(new Scene(root, 200, 200)); stageModal.initStyle(StageStyle.UTILITY); Label adresse = new Label("Adresse serveur:"); adresse.setLayoutX(10);//from w w w. ja v a 2s . co m adresse.setLayoutY(10); adresse.setFont(Font.font("Arial", 16)); JFXTextField adresseInput = new JFXTextField("127.0.0.1"); adresseInput.setPrefWidth(180); adresseInput.setLayoutX(10); adresseInput.setLayoutY(40); JFXButton valider = new JFXButton("Se connecter"); valider.setCursor(Cursor.HAND); valider.setMinSize(100, 30); valider.setLayoutX(20); valider.setLayoutY(130); valider.setFont(new Font(20)); valider.setStyle("-fx-background-color: #9E21FF;"); valider.setOnAction(event -> { if (adresseInput.getText() != "") { stageModal.close(); InitClient initializeClient = new InitClient(stage, adresseInput.getText(), port); } }); root.getChildren().add(valider); root.getChildren().add(adresse); root.getChildren().add(adresseInput); stageModal.setTitle("Adresse serveur"); stageModal.initModality(Modality.WINDOW_MODAL); stageModal.initOwner(((Node) eventT.getSource()).getScene().getWindow()); stageModal.show(); }
From source file:ui.ChoseFonctionnalite.java
private void initUI() { Pane root = new Pane(); root.setBackground(new Background(new BackgroundImage(new Image("resource/background.jpg"), BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.CENTER, new BackgroundSize(530, 400, true, true, true, true)))); JFXButton serveur = new JFXButton("SERVEUR"); serveur.setCursor(Cursor.HAND); serveur.setMinSize(171, 57);/*w ww .j av a 2s.c o m*/ serveur.setLayoutX(179); serveur.setLayoutY(90); serveur.setFont(new Font(27)); serveur.setStyle("-fx-background-color: #9E21FF;"); serveur.setOnAction(event -> { startServerMode(); }); JFXButton client = new JFXButton("CLIENT"); client.setCursor(Cursor.HAND); client.setMinSize(171, 57); client.setLayoutX(179); client.setLayoutY(197); client.setFont(new Font(27)); client.setStyle("-fx-background-color: #9E21FF;"); client.setOnAction(event -> { startClientMode(event); }); Label info = new Label("choisir la maniere d'utiliser virtual remote"); info.setMinSize(529, 43); info.setLayoutX(10); info.setLayoutY(14); info.setFont(new Font("Algerian", 20)); root.getChildren().add(client); root.getChildren().add(serveur); root.getChildren().add(info); Scene scene = new Scene(root, 530, 400); stage.setTitle("Fontionnalit"); stage.setScene(scene); stage.setResizable(false); stage.initStyle(StageStyle.DECORATED); stage.setOnCloseRequest(event -> { System.exit(1); }); stage.show(); }
From source file:jp.co.heppokoact.autocapture.FXMLDocumentController.java
/** * ???????????//from w w w.j a v a 2 s . c o m * ???????? * ???ESC???????? * * @return ??????? * @throws IOException ????? */ private Stage createTransparentStage() throws IOException { // ?????????? Stage transparentStage = new Stage(StageStyle.TRANSPARENT); transparentStage.initOwner(anchorPane.getScene().getWindow()); transparentStage.initModality(Modality.APPLICATION_MODAL); transparentStage.setResizable(false); Rectangle2D rect = Screen.getPrimary().getVisualBounds(); transparentStage.setWidth(rect.getWidth()); transparentStage.setHeight(rect.getHeight()); // ??? java.awt.Rectangle awtRect = new java.awt.Rectangle((int) rect.getWidth(), (int) rect.getHeight()); BufferedImage captureImage = robot.createScreenCapture(awtRect); // ?????? ByteArrayInputStream in = ImageUtil.convToInputStream(captureImage); BackgroundImage bgImage = new BackgroundImage(new Image(in), BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.DEFAULT, BackgroundSize.DEFAULT); Pane pane = new Pane(); pane.setBackground(new Background(bgImage)); pane.setStyle("-fx-border-color: rgba(255, 255, 0, 0.5); -fx-border-style: solid; -fx-border-width: 15;"); // ???ESC????? Scene scene = new Scene(pane); transparentStage.setScene(scene); scene.setOnKeyPressed(e -> { if (e.getCode() == KeyCode.ESCAPE) { transparentStage.close(); } }); return transparentStage; }