List of usage examples for javafx.stage StageStyle TRANSPARENT
StageStyle TRANSPARENT
To view the source code for javafx.stage StageStyle TRANSPARENT.
Click Source Link
From source file:com.jf.javafx.Application.java
/** * Start the application// ww w . j a v a 2 s . c o m * * @param primaryStage * @throws java.lang.Exception */ @Override public void start(Stage primaryStage) throws Exception { Application.sapp = this; this.pStage = primaryStage; // set env variables _initVars(); // load properties _initConfigurations(); _initStartupServices(); // handle on closing window primaryStage.setOnHidden((WindowEvent event) -> { _commitProperties(); }); primaryStage.initStyle(StageStyle.TRANSPARENT); primaryStage.setTitle(getResourceBundle().getString("app.title")); primaryStage.show(); }
From source file:smarthome.FXMLDocumentController.java
@FXML private void pwdChangeButtonAction(ActionEvent event) { Stage stage = new Stage(); //Fill stage with content stage.setTitle("New Window"); stage.setTitle("Smart Home"); Parent root;/*from w w w .j a v a2 s . c om*/ try { root = FXMLLoader.load(getClass().getResource("changeUserPasswd.fxml")); Undecorator undecorator = new Undecorator(stage, (Region) root); undecorator.getStylesheets().add("skin/undecorator.css"); Scene scene = new Scene(undecorator); stage.setScene(scene); scene.setFill(Color.TRANSPARENT); stage.initStyle(StageStyle.TRANSPARENT); stage.setScene(scene); stage.setResizable(false); stage.show(); } catch (IOException ex) { Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:de.mirkosertic.desktopsearch.DesktopSearch.java
@Override public void start(Stage aStage) throws Exception { // This is our base directory File theBaseDirectory = new File(SystemUtils.getUserHome(), "FreeSearchIndexDir"); theBaseDirectory.mkdirs();// www. ja va 2s . c o m configurationManager = new ConfigurationManager(theBaseDirectory); Notifier theNotifier = new Notifier(); stage = aStage; // Create the known preview processors PreviewProcessor thePreviewProcessor = new PreviewProcessor(); try { // Boot the search backend and set it up for listening to configuration changes backend = new Backend(theNotifier, configurationManager.getConfiguration(), thePreviewProcessor); configurationManager.addChangeListener(backend); // Boot embedded JSP container embeddedWebServer = new FrontendEmbeddedWebServer(aStage, backend, thePreviewProcessor, configurationManager); embeddedWebServer.start(); } catch (BindException | LockReleaseFailedException | LockObtainFailedException e) { // In this case, there is already an instance of DesktopSearch running // Inform the instance to bring it to front end terminate the current process. URL theURL = new URL(FrontendEmbeddedWebServer.getBringToFrontUrl()); // Retrieve the content, but it can be safely ignored // There must only be the get request Object theContent = theURL.getContent(); // Terminate the JVM. The window of the running instance is visible now. System.exit(0); } aStage.setTitle("Free Desktop Search"); aStage.setWidth(800); aStage.setHeight(600); aStage.initStyle(StageStyle.TRANSPARENT); FXMLLoader theLoader = new FXMLLoader(getClass().getResource("/scenes/mainscreen.fxml")); AnchorPane theMainScene = theLoader.load(); final DesktopSearchController theController = theLoader.getController(); theController.configure(this, backend, FrontendEmbeddedWebServer.getSearchUrl(), stage.getOwner()); Undecorator theUndecorator = new Undecorator(stage, theMainScene); theUndecorator.getStylesheets().add("/skin/undecorator.css"); Scene theScene = new Scene(theUndecorator); // Hacky, but works... theUndecorator.setStyle("-fx-background-color: rgba(0, 0, 0, 0);"); theScene.setFill(Color.TRANSPARENT); aStage.setScene(theScene); aStage.getIcons().add(new Image(getClass().getResourceAsStream("/fds.png"))); if (SystemTray.isSupported()) { Platform.setImplicitExit(false); SystemTray theTray = SystemTray.getSystemTray(); // We need to reformat the icon according to the current tray icon dimensions // this depends on the underlying OS java.awt.Image theTrayIconImage = Toolkit.getDefaultToolkit() .getImage(getClass().getResource("/fds_small.png")); int trayIconWidth = new TrayIcon(theTrayIconImage).getSize().width; TrayIcon theTrayIcon = new TrayIcon( theTrayIconImage.getScaledInstance(trayIconWidth, -1, java.awt.Image.SCALE_SMOOTH), "Free Desktop Search"); theTrayIcon.setImageAutoSize(true); theTrayIcon.setToolTip("FXDesktopSearch"); theTrayIcon.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 1) { Platform.runLater(() -> { if (stage.isIconified()) { stage.setIconified(false); } stage.show(); stage.toFront(); }); } } }); theTray.add(theTrayIcon); aStage.setOnCloseRequest(aEvent -> stage.hide()); } else { aStage.setOnCloseRequest(aEvent -> shutdown()); } aStage.setMaximized(true); aStage.show(); }
From source file:com.anavationllc.o2jb.ConfigurationApp.java
private void configureStage() { _actionTaken = reportAction(msg("action.terminated")); primaryStage.setTitle("Configure ODBC Settings"); primaryStage.initStyle(StageStyle.TRANSPARENT); primaryStage.setScene(getScene());/*from ww w . ja v a 2 s. c o m*/ }
From source file:de.chaosfisch.uploader.gui.GUIUploader.java
private void initApplication(final Stage primaryStage) { try {/* www . j a va2s . c om*/ final Parent parent = fxmlLoader .load(getClass().getResource("/de/chaosfisch/uploader/view/SimpleJavaYoutubeUploader.fxml"), resources) .getRoot(); final Scene scene = SceneBuilder.create().root(parent).fill(Color.TRANSPARENT).build(); try (InputStream iconInputStream = getClass() .getResourceAsStream("/de/chaosfisch/uploader/resources/images/film.png")) { StageBuilder.create().icons(new Image(iconInputStream)).minHeight(MIN_HEIGHT).height(MIN_HEIGHT) .minWidth(MIN_WIDTH).width(MIN_WIDTH).scene(scene).resizable(true) .onCloseRequest(new ApplicationClosePromptDialog()).applyTo(primaryStage); } parent.setOnMouseDragged(new EventHandler<MouseEvent>() { @Override public void handle(final MouseEvent me) { primaryStage.setX(me.getScreenX() - initX); primaryStage.setY(me.getScreenY() - initY); } }); parent.setOnMousePressed(new EventHandler<MouseEvent>() { @Override public void handle(final MouseEvent me) { initX = me.getScreenX() - primaryStage.getX(); initY = me.getScreenY() - primaryStage.getY(); } }); primaryStage.initStyle(StageStyle.TRANSPARENT); primaryStage.show(); } catch (final IOException e) { LOGGER.error("FXML Load error", e); throw new RuntimeException(e); } }
From source file:User.java
@Override public void start(Stage primaryStage) { this.primaryStage = primaryStage; user = new User(); primaryStage.initStyle(StageStyle.TRANSPARENT); root = new Group(); Scene scene = new Scene(root, 320, 112, Color.rgb(0, 0, 0, 0)); primaryStage.setScene(scene);//from w w w.ja v a 2 s . co m Rectangle background = this.drawRectangleBackground(); HBox row1 = this.drawRow1(); HBox row2 = this.drawRow2(); VBox formLayout = new VBox(4); // spacing formLayout.setLayoutX(12); formLayout.setLayoutY(12); formLayout.getChildren().addAll(row1, row2); root.getChildren().addAll(background, formLayout); primaryStage.show(); }
From source file:io.bitsquare.gui.main.overlays.Overlay.java
public void display() { if (owner == null) owner = MainView.getRootContainer(); if (owner != null) { Scene rootScene = owner.getScene(); if (rootScene != null) { Scene scene = new Scene(gridPane); scene.getStylesheets().setAll(rootScene.getStylesheets()); scene.setFill(Color.TRANSPARENT); setupKeyHandler(scene);/*from w ww. ja v a 2 s .c om*/ stage = new Stage(); stage.setScene(scene); Window window = rootScene.getWindow(); setModality(); stage.initStyle(StageStyle.TRANSPARENT); stage.show(); layout(); addEffectToBackground(); // On Linux the owner stage does not move the child stage as it does on Mac // So we need to apply centerPopup. Further with fast movements the handler loses // the latest position, with a delay it fixes that. // Also on Mac sometimes the popups are positioned outside of the main app, so keep it for all OS positionListener = (observable, oldValue, newValue) -> { if (stage != null) { layout(); if (centerTime != null) centerTime.stop(); centerTime = UserThread.runAfter(this::layout, 3); } }; window.xProperty().addListener(positionListener); window.yProperty().addListener(positionListener); window.widthProperty().addListener(positionListener); animateDisplay(); } } }
From source file:jp.co.heppokoact.autocapture.FXMLDocumentController.java
/** * ???????????/*from w ww . j a va 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; }