logo
down
shadow

Move application into second window monitor in javafx


Move application into second window monitor in javafx

By : Felix
Date : October 25 2020, 07:10 PM
like below fixes the issue I was writing java FX application. I have two monitors connected into one PC. I wanted to open application in the second window monitor. somehow I managed to do it with vbox not loading inside of them components. But when I try to load my fxml view into Parent it dosn't react at all. I was reviev following stackoverflow answer ` , I found it it's answer with following code
code :
    AnchorPane root = new AnchorPane();
    Scene scene = new Scene(root);
    int index = 1;
    for (Screen screen : Screen.getScreens()) {
        Rectangle2D bounds = screen.getVisualBounds();

            if(index == 2)
            {
            primaryStage.setX(bounds.getMinX());
            primaryStage.setY(bounds.getMinY());
            }
        index ++;
    }
    root.getChildren().add(FXMLLoader.load(getClass().getClassLoader().getResource("order_state_modal.fxml")));
    primaryStage.setMaximized(true);
    primaryStage.setScene(scene);
    primaryStage.show();


Share : facebook icon twitter icon
Is there a way to move a window to another monitor using Python?

Is there a way to move a window to another monitor using Python?


By : user3807160
Date : March 29 2020, 07:55 AM
wish helps you Use the pywin32 module to access the native Win32 API. The functions you'll need to use are:
EnumWindows to enumerate all of the top-level windows in the system; search for the one you want and save off the window handle EnumDisplayMonitors to enumerate all of the monitors in the system GetMonitorInfo to get the virtual display coordinates of a monitor and to determine whether or not each monitor is the primary monitor MoveWindow to move the window to the desired virtual display coordinates, using the window handle you found earlier
Choose which monitor does a JavaFX window open in

Choose which monitor does a JavaFX window open in


By : Joe
Date : March 29 2020, 07:55 AM
I wish did fix the issue. You can iterate Screen.getScreens() and move your stage to required one. See example below.
code :
public class FXScreens extends Application {

    @Override
    public void start(Stage stage) {
        VBox root = new VBox(10);
        root.setAlignment(Pos.CENTER);
        Scene scene = new Scene(root, 200, 250);

        int index = 1;
        for (Screen screen : Screen.getScreens()) {
            Rectangle2D bounds = screen.getVisualBounds();

            Button btn = new Button("Move me to Screen " + index++);
            btn.setOnAction((e) -> {
                stage.setX(bounds.getMinX() + 100);
                stage.setY(bounds.getMinY() + 100);
            });
            root.getChildren().add(btn);
        }

        stage.setTitle("Screen Jumper");
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
JAVAFX: Popup dialog appearing on primary monitor when application is on extended monitor

JAVAFX: Popup dialog appearing on primary monitor when application is on extended monitor


By : BinaryCat
Date : March 29 2020, 07:55 AM
hop of those help? The setX() and setY() methods of Stage are expecting coordinates specified in the screen coordinate system. You are passing in coordinates from the current scene coordinate system.
Replace
code :
Bounds currentMouseLocation=control.localToScene(control.getBoundsInLocal());
Bounds currentMouseLocation=control.localToScreen(control.getBoundsInLocal());
How to identify opened window is on which monitor while using primary and secondary monitors: JavaFx

How to identify opened window is on which monitor while using primary and secondary monitors: JavaFx


By : Maverick
Date : March 29 2020, 07:55 AM
this one helps. Use Screens.getScreensForRectangle. Using the bounds of your window you should be able to get a list of the screens used to display it's area:
code :
List<Screen> windowScreens = Screens.getScreensForRectangle(window.getX(), window.getY(),
                                                            window.getWidth(), window.getHeight());
Python in OS X: Detect multiple monitors and move application window to specific monitor

Python in OS X: Detect multiple monitors and move application window to specific monitor


By : Dejenie Demisse
Date : March 29 2020, 07:55 AM
I wish did fix the issue. To detect monitors, you can use NSScreen.screens(). You can then probably just position your NSWindow within the destination NSScreen's visibleFrame.
At least that would work with your own application windows -- I'm not sure about how to move a different application's window(s) or if it's even possible via the Cocoa API.
Related Posts Related Posts :
  • Is O(N!*N) an acceptable big oh complexity class or do I remove the constant and just say O(N!)?
  • Java File URI error?
  • Using an interface as a constructor parameter in Java?
  • Add additional path to exec-maven-plugin
  • Natural Language parsing of an appointment?
  • Java: How to tell which fontconfig file my system is currently using?
  • How to create notification icon badge on Android apps (like iPhone)
  • Interfaces with hibernate annotations
  • Getting ConnectionTimeoutException with the host did not accept the connection within timeout
  • How to get all property names of a Groovy class?
  • Java Netscape LDAP Remove One Attribute
  • A simple two column layout with Swing
  • Making a Linked list using Generics
  • how to handle result set data
  • Cloning java ArrayList and preventing it from modifications
  • Java How to call method of grand parents?
  • running jython bytecode using java
  • get content from website with utf8 format
  • Sendgrid v3: "Substitutions may not be used with dynamic templating"
  • Application freezes when running method
  • Maven versioning using git branches
  • does a Java getter incur a performance penalty
  • Open Source Implementation of Checkers
  • How can I make a resizable array in Java?
  • Change size of ImageIcon in a JRadioButton
  • Java memory mapped files and swap
  • JAXB Annotated class - setting of a variable which is not an element
  • JSF don't find component in view root with the form id
  • Using Mockito, how do I match against the key-value pair of a map?
  • How do I run my application as superuser from Eclipse?
  • Spring-Security: Call method after authentication
  • How can I add a password to this JDBC:ODBC connection string that is trying to connect to an MS Access database
  • java.sql.SQLException: database locked
  • Json Jackson deserialization without inner classes
  • Error starting modern compiler
  • Generate a random number in interval [0,360) which is divisible by number 15
  • Rotate watermark text at 45 degree angle across the center Apache PDFBox
  • Generate Random number in a range with no repeatation
  • Starting HBASE, java.lang.ClassNotFoundException: org.apache.htrace.SamplerBuilder
  • Using getter and setter methods inside a class in my main class
  • java: <identifier> expected with ArrayList
  • Java Reflection, java.lang.IllegalAccessException Error
  • Looking for a lightweight java-compatible in-memory key-value store
  • What is your development checklist for Java low-latency application?
  • Read a line in java and then tokenize it
  • How to format a date using Apache Derby?
  • Explicitly multiplying values as longs
  • Starting out NLP - Python + large data set
  • Software Testing Tools - for java
  • JDBC transaction dead-lock: solution required?
  • Measuring the time to create and destroy a simple object
  • Javadoc error: "option --boot-class-path not allowed with target 11"
  • How can I store values in a hashmap with <String, List<Integer>>
  • JDBC ODBC.. (Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException)
  • Unable to detect Capture Device (webcam) through JMF
  • Audio fingerprinting library (java)
  • Help matching fields between two classes
  • Access variables between nested JSP tags
  • AES Encryption Java Invalid Key length
  • How to initiate chatting between two clients and two clients only, using applets and servlets?
  • shadow
    Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk