B4J Question How to check for PrimaryScreen (multiple monitors)


Well-Known Member
Licensed User
With a bunch or monitors how to determine which one is the primary ?


Well-Known Member
Licensed User
I solved it myself here's how it's done. You will need to use jAWTRobot library for this to work.

    Private AWTRobot As AWTRobot
    Private s As Screen
    Private x,y As Int

    ' Read Mouse Cursor Position X & Y
    Private m() As Int = AWTRobot.RobotMouseCurrentLocation
    x = m(0)
    y = m(1)

    ' Get Primary Monitor
    s = fx.PrimaryScreen
        ' When within Primary Monitor and Mouse Boundaries
        If s = fx.PrimaryScreen And x >=0 And x <= primaryWidth Then

             'Do stuff...

        End If
Last edited:
Upvote 0