javafx.stage.Screen Java Examples
The following examples show how to use
javafx.stage.Screen.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReceptionistController.java From HealthPlus with Apache License 2.0 | 8 votes |
@FXML public void showAppointmentSuccessIndicator(String patientId, String consult, String appDate, String appId) { Stage stage= new Stage(); AppointmentSuccessController success = new AppointmentSuccessController(); success.fillAppointmentData(patientId,consult,appDate,appId); Scene scene = new Scene(success); stage.setScene(scene); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); //set Stage boundaries to visible bounds of the main screen stage.setX(primaryScreenBounds.getMinX()); stage.setY(primaryScreenBounds.getMinY()); stage.setWidth(primaryScreenBounds.getWidth()); stage.setHeight(primaryScreenBounds.getHeight()); stage.initStyle(StageStyle.UNDECORATED); scene.setFill(null); stage.initStyle(StageStyle.TRANSPARENT); stage.show(); }
Example #2
Source File: HttpDownApplication.java From proxyee-down with Apache License 2.0 | 6 votes |
@Override public void start(Stage stage) throws Exception { initHandle(); this.stage = stage; Platform.setImplicitExit(false); SwingUtilities.invokeLater(this::addTray); stage.setTitle("proxyee-down-" + version); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); stage.setX(primaryScreenBounds.getMinX()); stage.setY(primaryScreenBounds.getMinY()); stage.setWidth(primaryScreenBounds.getWidth()); stage.setHeight(primaryScreenBounds.getHeight()); stage.getIcons().add(new Image( Thread.currentThread().getContextClassLoader().getResourceAsStream("favicon.png"))); stage.setOnCloseRequest(event -> { event.consume(); close(); }); beforeOpen(); // open(); afterOpen(); }
Example #3
Source File: UserAccountController.java From HealthPlus with Apache License 2.0 | 6 votes |
@FXML private void sendMsg1() { Stage stage= new Stage(); NewMessageController newMessage = new NewMessageController(admin); newMessage.userid.setText(msgLabel1.getText()); newMessage.receivertxt.setText(" "+userName1.getText()); Scene scene = new Scene(newMessage); stage.setScene(scene); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); //set Stage boundaries to visible bounds of the main screen stage.setX(primaryScreenBounds.getMinX()); stage.setY(primaryScreenBounds.getMinY()); stage.setWidth(primaryScreenBounds.getWidth()); stage.setHeight(primaryScreenBounds.getHeight()); stage.initStyle(StageStyle.UNDECORATED); scene.setFill(null); stage.initStyle(StageStyle.TRANSPARENT); stage.show(); }
Example #4
Source File: LoginController.java From HealthPlus with Apache License 2.0 | 6 votes |
public void loadReceptionist(String username) { Stage stage = new Stage(); ReceptionistController receptionist = new ReceptionistController(username); receptionist.loadProfileData(); receptionist.makeSummaryTable(); receptionist.fillLineChart(); receptionist.fillCurrentDoctors(); //receptionist.fillConsultationAreas(); receptionist.setPaceholders(); stage.setScene(new Scene(receptionist)); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); //set Stage boundaries to visible bounds of the main screen stage.setX(primaryScreenBounds.getMinX()); stage.setY(primaryScreenBounds.getMinY()); stage.setWidth(primaryScreenBounds.getWidth()); stage.setHeight(primaryScreenBounds.getHeight()); stage.initStyle(StageStyle.UNDECORATED); stage.show(); }
Example #5
Source File: UserAccountController.java From HealthPlus with Apache License 2.0 | 6 votes |
@FXML private void sendMsg3() { Stage stage= new Stage(); NewMessageController newMessage = new NewMessageController(admin); newMessage.userid.setText(msgLabel3.getText()); newMessage.receivertxt.setText(" "+userName3.getText()); Scene scene = new Scene(newMessage); stage.setScene(scene); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); //set Stage boundaries to visible bounds of the main screen stage.setX(primaryScreenBounds.getMinX()); stage.setY(primaryScreenBounds.getMinY()); stage.setWidth(primaryScreenBounds.getWidth()); stage.setHeight(primaryScreenBounds.getHeight()); stage.initStyle(StageStyle.UNDECORATED); scene.setFill(null); stage.initStyle(StageStyle.TRANSPARENT); stage.show(); }
Example #6
Source File: SysUserController.java From HealthPlus with Apache License 2.0 | 6 votes |
public void showSuccessIndicator() { Stage stage= new Stage(); SuccessIndicatorController success = new SuccessIndicatorController(); Scene scene = new Scene(success); stage.setScene(scene); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); //set Stage boundaries to visible bounds of the main screen stage.setX(primaryScreenBounds.getMinX()); stage.setY(primaryScreenBounds.getMinY()); stage.setWidth(primaryScreenBounds.getWidth()); stage.setHeight(primaryScreenBounds.getHeight()); stage.initStyle(StageStyle.UNDECORATED); scene.setFill(null); stage.initStyle(StageStyle.TRANSPARENT); stage.show(); }
Example #7
Source File: PharmacistController.java From HealthPlus with Apache License 2.0 | 6 votes |
@FXML public void showSuccessIndicator() { Stage stage= new Stage(); SuccessIndicatorController success = new SuccessIndicatorController(); Scene scene = new Scene(success); stage.setScene(scene); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); //set Stage boundaries to visible bounds of the main screen stage.setX(primaryScreenBounds.getMinX()); stage.setY(primaryScreenBounds.getMinY()); stage.setWidth(primaryScreenBounds.getWidth()); stage.setHeight(primaryScreenBounds.getHeight()); stage.initStyle(StageStyle.UNDECORATED); scene.setFill(null); stage.initStyle(StageStyle.TRANSPARENT); stage.show(); }
Example #8
Source File: NewMessageController.java From HealthPlus with Apache License 2.0 | 6 votes |
public void showSuccessIndicator() { Stage stage= new Stage(); SuccessIndicatorController success = new SuccessIndicatorController(); Scene scene = new Scene(success); stage.setScene(scene); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); //set Stage boundaries to visible bounds of the main screen stage.setX(primaryScreenBounds.getMinX()); stage.setY(primaryScreenBounds.getMinY()); stage.setWidth(primaryScreenBounds.getWidth()); stage.setHeight(primaryScreenBounds.getHeight()); stage.initStyle(StageStyle.UNDECORATED); scene.setFill(null); stage.initStyle(StageStyle.TRANSPARENT); stage.show(); }
Example #9
Source File: PharmacistController.java From HealthPlus with Apache License 2.0 | 6 votes |
@FXML private void addNewDrug() { Stage stage= new Stage(); AddNewDrugController addDrug = new AddNewDrugController(pharmacist,this); addDrug.loadGenericNames(); Scene scene = new Scene(addDrug); stage.setScene(scene); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); //set Stage boundaries to visible bounds of the main screen stage.setX(primaryScreenBounds.getMinX()); stage.setY(primaryScreenBounds.getMinY()); stage.setWidth(primaryScreenBounds.getWidth()); stage.setHeight(primaryScreenBounds.getHeight()); stage.initStyle(StageStyle.UNDECORATED); scene.setFill(null); stage.initStyle(StageStyle.TRANSPARENT); stage.show(); }
Example #10
Source File: AdminController.java From HealthPlus with Apache License 2.0 | 6 votes |
@FXML private void viewOnlineAccounts() { Stage stage = new Stage(); UserAccountController userAccounts = new UserAccountController("",admin); ArrayList<ArrayList<String>> data = admin.getOnlineInfo(); userAccounts.fillUserDetail(data); Scene scene = new Scene(userAccounts); stage.setScene(scene); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); //set Stage boundaries to visible bounds of the main screen stage.setX(primaryScreenBounds.getMinX()); stage.setY(primaryScreenBounds.getMinY()); stage.setWidth(primaryScreenBounds.getWidth()); stage.setHeight(primaryScreenBounds.getHeight()); stage.initStyle(StageStyle.UNDECORATED); scene.setFill(null); stage.initStyle(StageStyle.TRANSPARENT); stage.show(); }
Example #11
Source File: NotificationView.java From Maus with GNU General Public License v3.0 | 6 votes |
public static void openNotification(ClientObject client) { 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("New Connection: " + client.getIP() + " (" + client.getNickName() + ")"); stage.show(); PauseTransition delay = new PauseTransition(Duration.seconds(5)); delay.setOnFinished(event -> stage.close()); delay.play(); }
Example #12
Source File: ReadMessageController.java From HealthPlus with Apache License 2.0 | 6 votes |
public void showSuccessIndicator() { Stage stage= new Stage(); SuccessIndicatorController success = new SuccessIndicatorController(); Scene scene = new Scene(success); stage.setScene(scene); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); //set Stage boundaries to visible bounds of the main screen stage.setX(primaryScreenBounds.getMinX()); stage.setY(primaryScreenBounds.getMinY()); stage.setWidth(primaryScreenBounds.getWidth()); stage.setHeight(primaryScreenBounds.getHeight()); stage.initStyle(StageStyle.UNDECORATED); scene.setFill(null); stage.initStyle(StageStyle.TRANSPARENT); stage.show(); }
Example #13
Source File: GraphicsDeviceWatcher.java From Quelea with GNU General Public License v3.0 | 6 votes |
/** * Create a new device watcher. Internal use only (singleton.) */ private GraphicsDeviceWatcher() { //lastDeviceCount = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices().length; lastDeviceCount = javafx.stage.Screen.getScreens().size(); listeners = new ArrayList<>(); poller = Executors.newScheduledThreadPool(1); poller.scheduleAtFixedRate(() -> { //GraphicsDevice[] devices = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); ObservableList<Screen> monitors = Screen.getScreens(); int thisDeviceCount = monitors.size(); // devices.length; if(thisDeviceCount != lastDeviceCount) { for(GraphicsDeviceListener listener : listeners) { LOGGER.log(Level.INFO, "Number of devices changed, was {0} now {1}", new Object[]{lastDeviceCount, thisDeviceCount}); if (thisDeviceCount > lastDeviceCount && QueleaProperties.get().getUseAutoExtend()) { QueleaProperties.get().setProjectorScreen(thisDeviceCount - 1); } lastDeviceCount = thisDeviceCount; listener.devicesChanged(monitors); } } }, 0, 3, TimeUnit.SECONDS); }
Example #14
Source File: AddNewDrugController.java From HealthPlus with Apache License 2.0 | 6 votes |
public void showSuccessIndicator() { Stage stage= new Stage(); SuccessIndicatorController success = new SuccessIndicatorController(); Scene scene = new Scene(success); stage.setScene(scene); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); //set Stage boundaries to visible bounds of the main screen stage.setX(primaryScreenBounds.getMinX()); stage.setY(primaryScreenBounds.getMinY()); stage.setWidth(primaryScreenBounds.getWidth()); stage.setHeight(primaryScreenBounds.getHeight()); stage.initStyle(StageStyle.UNDECORATED); scene.setFill(null); stage.initStyle(StageStyle.TRANSPARENT); stage.show(); }
Example #15
Source File: QNotification.java From mars-sim with GNU General Public License v3.0 | 6 votes |
private double getY() { double h1 = Screen.getPrimary().getBounds().getWidth(); double h2 = 0; if (Screen.getScreens().size() == 2) { h2 = Screen.getScreens().get(1).getBounds().getWidth(); } // check if mainScene is on primary or secondary and set h0 double m = getMonitor(h2); double h0 = 0; if (m == 1) h0 = h1; else h0 = h2; //System.out.println("height is " + h0); if (null == stageRef) return calcY( 0.0, h0 ); return calcY(stageRef.getY(), stageRef.getHeight()); }
Example #16
Source File: UndecoratorController.java From DevToolBox with GNU Lesser General Public License v2.1 | 6 votes |
/** * Based on mouse position returns dock side * * @param mouseEvent * @return DOCK_LEFT,DOCK_RIGHT,DOCK_TOP */ int getDockSide(MouseEvent mouseEvent) { double minX = Double.POSITIVE_INFINITY; double minY = Double.POSITIVE_INFINITY; double maxX = 0; double maxY = 0; // Get "big" screen bounds ObservableList<Screen> screens = Screen.getScreens(); for (Screen screen : screens) { Rectangle2D visualBounds = screen.getVisualBounds(); minX = Math.min(minX, visualBounds.getMinX()); minY = Math.min(minY, visualBounds.getMinY()); maxX = Math.max(maxX, visualBounds.getMaxX()); maxY = Math.max(maxY, visualBounds.getMaxY()); } // Dock Left if (mouseEvent.getScreenX() == minX) { return DOCK_LEFT; } else if (mouseEvent.getScreenX() >= maxX - 1) { // MaxX returns the width? Not width -1 ?! return DOCK_RIGHT; } else if (mouseEvent.getScreenY() <= minY) { // Mac menu bar return DOCK_TOP; } return 0; }
Example #17
Source File: LoginController.java From HealthPlus with Apache License 2.0 | 6 votes |
public void loadDoctor(String username) { Stage stage = new Stage(); DoctorController doctor = new DoctorController(username); doctor.fillAreaChart(); doctor.setAppointments(); doctor.loadProfileData(); doctor.MakeAvailabilityTable(); doctor.loadDrugList(); doctor.loadTestList(); doctor.setPaceholders(); doctor.addFocusListener(); doctor.loadNameList(); stage.setScene(new Scene(doctor)); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); //set Stage boundaries to visible bounds of the main screen stage.setX(primaryScreenBounds.getMinX()); stage.setY(primaryScreenBounds.getMinY()); stage.setWidth(primaryScreenBounds.getWidth()); stage.setHeight(primaryScreenBounds.getHeight()); stage.initStyle(StageStyle.UNDECORATED); stage.show(); }
Example #18
Source File: CashierController.java From HealthPlus with Apache License 2.0 | 6 votes |
@FXML public void showRefundTable() { Stage stage= new Stage(); RefundController refundTable = new RefundController(this); refundTable.fillRefundTable(); Scene scene = new Scene(refundTable); stage.setScene(scene); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); //set Stage boundaries to visible bounds of the main screen stage.setX(primaryScreenBounds.getMinX()); stage.setY(primaryScreenBounds.getMinY()); stage.setWidth(primaryScreenBounds.getWidth()); stage.setHeight(primaryScreenBounds.getHeight()); stage.initStyle(StageStyle.UNDECORATED); scene.setFill(null); stage.initStyle(StageStyle.TRANSPARENT); stage.show(); }
Example #19
Source File: WindowController.java From logbook-kai with MIT License | 6 votes |
/** * ウインドウの位置とサイズを設定します。 * @param location ウインドウの位置とサイズ */ public void setWindowLocation(WindowLocation location) { if (location != null) { boolean intersect = Screen.getScreens() .stream() .map(Screen::getVisualBounds) .anyMatch(r -> r.intersects( location.getX(), location.getY(), location.getWidth(), location.getHeight())); if (intersect) { this.window.setX(location.getX()); this.window.setY(location.getY()); this.window.setWidth(location.getWidth()); this.window.setHeight(location.getHeight()); } } }
Example #20
Source File: AdminController.java From HealthPlus with Apache License 2.0 | 6 votes |
@FXML private void showSettings() throws IOException { Stage stage = new Stage(); SettingsController settings = new SettingsController(admin,this); settings.loadConfigFile(); Scene scene = new Scene(settings); stage.setScene(scene); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); //set Stage boundaries to visible bounds of the main screen stage.setX(primaryScreenBounds.getMinX()); stage.setY(primaryScreenBounds.getMinY()); stage.setWidth(primaryScreenBounds.getWidth()); stage.setHeight(primaryScreenBounds.getHeight()); stage.initStyle(StageStyle.UNDECORATED); scene.setFill(null); stage.initStyle(StageStyle.TRANSPARENT); stage.show(); }
Example #21
Source File: ReceptionistController.java From HealthPlus with Apache License 2.0 | 6 votes |
@FXML public void showSuccessIndicator() { Stage stage= new Stage(); SuccessIndicatorController success = new SuccessIndicatorController(); Scene scene = new Scene(success); stage.setScene(scene); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); //set Stage boundaries to visible bounds of the main screen stage.setX(primaryScreenBounds.getMinX()); stage.setY(primaryScreenBounds.getMinY()); stage.setWidth(primaryScreenBounds.getWidth()); stage.setHeight(primaryScreenBounds.getHeight()); stage.initStyle(StageStyle.UNDECORATED); scene.setFill(null); stage.initStyle(StageStyle.TRANSPARENT); stage.show(); }
Example #22
Source File: DisplayWindow.java From marathonv5 with Apache License 2.0 | 6 votes |
public ControllerStage(DisplayWindow stage) { this.displayWindow = stage; setTitle("Marathon Control Center"); getIcons().add(FXUIUtils.getImageURL("logo16")); getIcons().add(FXUIUtils.getImageURL("logo32")); initComponents(); Scene scene = new Scene(content); content.getStyleClass().add(StyleClassHelper.BACKGROUND); setScene(scene); setAlwaysOnTop(true); setOnShown((e) -> { Rectangle2D screenBounds = Screen.getPrimary().getVisualBounds(); setX(screenBounds.getWidth() - getWidth()); setY(0); }); sizeToScene(); setResizable(false); setOnCloseRequest(e -> displayWindow.onStop()); }
Example #23
Source File: ReceptionistController.java From HealthPlus with Apache License 2.0 | 6 votes |
@FXML private void showAppointments() { Stage stage= new Stage(); AllAppointmentsController app = new AllAppointmentsController(receptionist); app.load(); Scene scene = new Scene(app); stage.setScene(scene); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); //set Stage boundaries to visible bounds of the main screen stage.setX(primaryScreenBounds.getMinX()); stage.setY(primaryScreenBounds.getMinY()); stage.setWidth(primaryScreenBounds.getWidth()); stage.setHeight(primaryScreenBounds.getHeight()); stage.initStyle(StageStyle.UNDECORATED); scene.setFill(null); stage.initStyle(StageStyle.TRANSPARENT); stage.show(); }
Example #24
Source File: DownApplication.java From proxyee-down with Apache License 2.0 | 6 votes |
private void initWindow() { stage.setTitle("Proxyee Down"); Rectangle2D bounds = Screen.getPrimary().getVisualBounds(); int width = 1024; int height = 576; stage.setX((bounds.getWidth() - width) / 2); stage.setY((bounds.getHeight() - height) / 2); stage.setMinWidth(width); stage.setMinHeight(height); stage.getIcons().add(new javafx.scene.image.Image(Thread.currentThread().getContextClassLoader().getResourceAsStream(ICON_PATH))); stage.setResizable(true); //关闭窗口监听 stage.setOnCloseRequest(event -> { event.consume(); stage.hide(); }); }
Example #25
Source File: DoctorController.java From HealthPlus with Apache License 2.0 | 6 votes |
@FXML private void addTimeSlot() { Stage stage= new Stage(); NewDoctorTimeSlotController addslot = new NewDoctorTimeSlotController(doc,this); Scene scene = new Scene(addslot); stage.setScene(scene); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); //set Stage boundaries to visible bounds of the main screen stage.setX(primaryScreenBounds.getMinX()); stage.setY(primaryScreenBounds.getMinY()); stage.setWidth(primaryScreenBounds.getWidth()); stage.setHeight(primaryScreenBounds.getHeight()); stage.initStyle(StageStyle.UNDECORATED); scene.setFill(null); stage.initStyle(StageStyle.TRANSPARENT); stage.show(); }
Example #26
Source File: DoctorController.java From HealthPlus with Apache License 2.0 | 6 votes |
@FXML public void showSuccessIndicator() { Stage stage= new Stage(); SuccessIndicatorController success = new SuccessIndicatorController(); Scene scene = new Scene(success); stage.setScene(scene); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); //set Stage boundaries to visible bounds of the main screen stage.setX(primaryScreenBounds.getMinX()); stage.setY(primaryScreenBounds.getMinY()); stage.setWidth(primaryScreenBounds.getWidth()); stage.setHeight(primaryScreenBounds.getHeight()); stage.initStyle(StageStyle.UNDECORATED); scene.setFill(null); stage.initStyle(StageStyle.TRANSPARENT); stage.show(); }
Example #27
Source File: AdminController.java From HealthPlus with Apache License 2.0 | 6 votes |
@FXML private void viewDoctorAccounts() { Stage stage = new Stage(); UserAccountController userAccounts = new UserAccountController("doctor",admin); ArrayList<ArrayList<String>> data = admin.getUserInfo("doctor"); userAccounts.fillUserDetail(data); Scene scene = new Scene(userAccounts); stage.setScene(scene); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); //set Stage boundaries to visible bounds of the main screen stage.setX(primaryScreenBounds.getMinX()); stage.setY(primaryScreenBounds.getMinY()); stage.setWidth(primaryScreenBounds.getWidth()); stage.setHeight(primaryScreenBounds.getHeight()); stage.initStyle(StageStyle.UNDECORATED); scene.setFill(null); stage.initStyle(StageStyle.TRANSPARENT); stage.show(); }
Example #28
Source File: HostelProject.java From Hostel-Management-System with MIT License | 6 votes |
@Override public void start(Stage stage) throws SQLException, IOException { Parent root = FXMLLoader.load(getClass().getResource("MainScene.fxml")); scene = new Scene(root); Screen screen = Screen.getPrimary(); Rectangle2D bounds = screen.getVisualBounds(); Image ico=new Image("file:///D:/Study/Java/HostelProjecttest/src/hostelproject/media/net.png"); stage.setTitle("Banda Singh Bahadur Boys Hostel"); stage.getIcons().add(ico); stage.setX(bounds.getMinX()); stage.setY(bounds.getMinY()); stage.setWidth(bounds.getWidth()); stage.setHeight(bounds.getHeight()); stage.setScene(scene); stage.show(); }
Example #29
Source File: AdminController.java From HealthPlus with Apache License 2.0 | 6 votes |
@FXML private void viewCashierAccounts() { Stage stage = new Stage(); UserAccountController userAccounts = new UserAccountController("cashier",admin); ArrayList<ArrayList<String>> data = admin.getUserInfo("cashier"); System.out.println(data); userAccounts.fillUserDetail(data); Scene scene = new Scene(userAccounts); stage.setScene(scene); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); //set Stage boundaries to visible bounds of the main screen stage.setX(primaryScreenBounds.getMinX()); stage.setY(primaryScreenBounds.getMinY()); stage.setWidth(primaryScreenBounds.getWidth()); stage.setHeight(primaryScreenBounds.getHeight()); stage.initStyle(StageStyle.UNDECORATED); scene.setFill(null); stage.initStyle(StageStyle.TRANSPARENT); stage.show(); }
Example #30
Source File: OverlayStage.java From DeskChan with GNU Lesser General Public License v3.0 | 6 votes |
public static Rectangle2D getDesktopSize() { Rectangle2D rect = Screen.getPrimary().getBounds(); double minX = rect.getMinX(), minY = rect.getMinY(); double maxX = rect.getMaxX(), maxY = rect.getMaxY(); for (Screen screen : Screen.getScreens()) { Rectangle2D screenRect = screen.getBounds(); if (minX > screenRect.getMinX()) { minX = screenRect.getMinX(); } if (minY > screenRect.getMinY()) { minY = screenRect.getMinY(); } if (maxX < screenRect.getMaxX()) { maxX = screenRect.getMaxX(); } if (maxY < screenRect.getMaxY()) { maxY = screenRect.getMaxY(); } } return new Rectangle2D(minX, minY, maxX - minX, maxY - minY); }