Hi,

 

What do you mean by “external monitor” ? I work on a Windows computer (not a
laptop) with 3 screens so would you say that I have 3 monitors or 3 three
external monitors ?

This piece of code:

 

   GraphicsEnvironment ge =
GraphicsEnvironment.getLocalGraphicsEnvironment();

   GraphicsDevice[] gs = ge.getScreenDevices();

   System.out.println("No of monitord"+ge.getDefaultScreenDevice());

 

works (and have worked for many years) on my computer with Windows 7/10/11
and many versions of JAVA.

 

The question is more about how this external monitor/TV is being seen by the
system. Is it a second monitor ? Is it a monitor that duplicate the image of
the main monitor ? Is it a “pure” TV screen ?

As already said, if Java is not aware of this monitor, the problem lies in
the system, between the OS, the driver of the monitor and the JVM, not in
your code and not in Netbeans.

 

Have a good day.

Marc

 

 

De : Murali Govind <murali...@gmail.com> 
Envoyé : vendredi 13 janvier 2023 04:58
À : Ernie Rael <err...@raelity.com>
Cc : users@netbeans.apache.org
Objet : Re: External monitors.

 

Hi

 

Thanks for taking the time. I am not sure I follow.

 

- This does not work even if I use q windows computer.

- I need the software to do the redirection to an external monitor. The
users are not savvy enough to do that.

 

Is that doable?. I can find lot of sample code. Which suggests it must be
possible. I may be doing something wrong.

 

Regards

Murali





On 12 Jan 2023, at 11:32 PM, Ernie Rael <err...@raelity.com
<mailto:err...@raelity.com> > wrote:

 

Looks like the issue is between the MacBook and JDK. (No NetBeans APIs
involved). If you can move MAC windows to the external monitor, then you
need JDK support.

 

-ernie

 

On 23/01/12 12:13 AM, Murali Govind wrote:

Hi 

 

Any one can help with the below problem?

 

Regards

Murali





On 6 Jan 2023, at 11:30 AM, Murali Govind <murali...@gmail.com
<mailto:murali...@gmail.com> > wrote:

 

Hi 

 

I have a Laptop- MacBook Air.. And I have a TV connected to it via USB C ->
HDMI . I have tried everything in the code snippets I could find in google. 

 

public static void disponscreen() {
    System.out.println("Hello from the Disp on screen  Function!");
  
 
    Integer j=0;
         GraphicsEnvironment ge = GraphicsEnvironment.
   getLocalGraphicsEnvironment();
   GraphicsDevice[] gs = ge.getScreenDevices();
   System.out.println("No of monitord"+ge.getDefaultScreenDevice());
           
    System.out.println("No of monitord"+gs.length);
      GraphicsDevice gd = gs[0];
      GraphicsConfiguration[] gc = gd.getConfigurations();
    
         JFrame f = new JFrame("simple gui");
         
              f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              JLabel textLabel = new JLabel("I'm a label in the window");   
              textLabel.setPreferredSize(new Dimension(300, 100));  
             f.getContentPane().add(textLabel, BorderLayout.CENTER);  
              //Display the window.       frame.setLocationRelativeTo(null);
frame.pack();       frame.setVisible(true);    }    public static void
main(String[] args) {       createWindow();    } }
            f.setVisible(true);
           
    }
         public static void main(String[] args) {
    System.out.println("Hello from the Java Main Function!");
    disponscreen();
  
  }
 
gs.length is 1 regardless of connecting or not connecting a TV
 
 
 

gs.length is 1 regardless of connecting or not connecting a TV

I expect to have gs.length = 2. Ie two devices connected.

 

Anyone can help??

 

Regards

Murali

 

 

 

 

 

Reply via email to