Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7086153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:30:52+00:00 2026-05-28T07:30:52+00:00

I have dual head (VGA output, DVI or HDMI output) from 1 PC using

  • 0

I have dual head (VGA output, DVI or HDMI output) from 1 PC using this xrandr --output VGA1 --left-of LVDS1. Each having 1024×768 resolution.

When i use this using Java:

screen = Toolkit.getDefaultToolkit().getScreenSize();

I get a huge two screen width together. As a result my Width and height is huge.
Where i only need to place my application in one screen either VGA or DVI. But using Java how do i know that?

How do i tell that using Toolkit.getDefaultToolkit() ?

Example: (my application has to run where Java is labeled)

enter image description here

Test.java

import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;

public class Test {

  public static void main(String[] a) throws Exception {
      GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
      GraphicsDevice[] screenDevices = ge.getScreenDevices();
      for (int i = 0; i < screenDevices.length; i++) {
        System.out.println(screenDevices[i].getIDstring());

        DisplayMode dm = screenDevices[i].getDisplayMode();
        int screenWidth = dm.getWidth();
        int screenHeight = dm.getHeight(); 

        System.out.println("Cake: " + screenWidth + " " + screenHeight);
      }      
  }
}

Output:

:0.0
Cake: 1024 768
:0.1
Cake: 1024 768
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:30:53+00:00Added an answer on May 28, 2026 at 7:30 am

    I think

    GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()
    

    is what you are looking for. And then from there you can iterate through the screens and get the screen dimension by getDisplayMode()

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this SQL script i my app: select my_seq.nextval from dual connect by
I have this statement: SELECT passwdlib.piv_insertPasswd(:A1, :A2) FROM DUAL I am guessing that piv_insertPasswd
I have a dual-boot OS X / Ubuntu and am currently using separate Eclipse
OK I have read many posts regarding Dual Licensing using MIT and GPL licenses.
i have this code. <p>jQuery is free, open source software, dual-licensed under the <span>MIT
Currently we have developed application using Java 6 based on windows 32bit(Dual core &
Let's suppose I have a timestamp variable: select timestamp '2011-02-24 08:30:42 +06:00' from dual;
I have to create a dual-thumb slider using the YUI 3 libraries. A single
I have 2 queries in SQL: select trunc(to_date('27-Jul-1987'),'YYYY') FROM dual; and select trunc(to_date('27-Jul-1987'),'RRRR') FROM
I have a larger SQL that produces a similar output as this simplified example:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.