3

Is it possible to alter (change/update) display settings (configuration) in Windows XP using Java programming language?

I would like to do something like this:

Display[] displays = WindowsXPSystem.getDisplays(); //get all available displays (monitors). assume there are currently two monitors connected 
Display d0 = displays[0]; // the first is 24" and is positioned on the left
d0.setPrimary(true); // and it should be primary, so all new windows open on it.
d0.setSize(new Dimension(1920,1080)); //update screen size (resolution)
d0.setPossition(0,0); //and position it on the left

Display d1 = displays[1]; //second monitor is also present
d1.setSize(new Dimension(1440,768)); // and it's 14.1" laptop's display
d1.setPossition(1920,332); //it's positioned on the right

Any ideas/suggestions/APIs how to update display settings with Java?

2 Answers 2

1

I think this is not possible with plain Java. Have a look at this question here:

Detect and Change display resolution permanently using java

as stated there, it's maybe possible to use any native Libraries through JNI (Java Native Interface) which kind of wraps native Libraries. But you will loose your platform independency then.

Sign up to request clarification or add additional context in comments.

Comments

1

There is no plain Java solution to your problem. The function is way to specific for a generic implementation.

You could however, if you really need to implement this use a JNI library, that wraps the Windows functionality of adjusting the screen resolution.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.