List of issuesList of issues

#451 Dialogue windows are not showing on the center of the screen on a multi-monitor configuration
Author: user helmy
Date created:
Type: bug
Visibility: Everybody
Assigned to:
Labels: GUI
State: closed Help

> What steps will reproduce the problem? open the application, then from help click about > What is the expected output? What do you see instead? the Dialogue window should open in the center of the screen, instead it shows up between the 2 screens i have here > additional information: i was able to fix this in the code by modifying the centerScreen method located in trunk/src/com/jpexs/decompiler/flash/gui/View.java to have this : //sets the window to the center of the first screen f.setLocationRelativeTo(null);
developer
I've added your line. Please get the latest code, or try the latet nightly build.
State: new→upgraded
user
when testing on another linux setup i found that, f.setLocationRelativeTo(null); didn't work too well on an older versions of openjdk (the open source implementation of JDK) here is a the full centerScreen method that i have tested and it should work everywhere public static void centerScreen(Window f) { centerScreen(f, 0);// todo, set screen to the currently active screen instead of the first screen in a multi screen setup, (maybe by using the screen where the main window is now classic or ribbon?) } public static void centerScreen(Window f,int screen) { GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] allDevices = env.getScreenDevices(); int topLeftX, topLeftY, screenX, screenY, windowPosX, windowPosY; if (screen < allDevices.length && screen > -1) { topLeftX = allDevices[screen].getDefaultConfiguration().getBounds().x; topLeftY = allDevices[screen].getDefaultConfiguration().getBounds().y; screenX = allDevices[screen].getDefaultConfiguration().getBounds().width; screenY = allDevices[screen].getDefaultConfiguration().getBounds().height; } else { topLeftX = allDevices[0].getDefaultConfiguration().getBounds().x; topLeftY = allDevices[0].getDefaultConfiguration().getBounds().y; screenX = allDevices[0].getDefaultConfiguration().getBounds().width; screenY = allDevices[0].getDefaultConfiguration().getBounds().height; } windowPosX = ((screenX - f.getWidth()) / 2) + topLeftX; windowPosY = ((screenY - f.getHeight()) / 2) + topLeftY; f.setLocation(windowPosX, windowPosY); }
developer
I checked in this method, too. It it ok now?
user
yes it is ok, PS: you can IM me by gtalk : qpdbdp[at]gmail.com
developer
State: upgraded→closed
 
Google Translate: Translate to Czech Translate to Slovak Translate to Russian Translate to Hungarian Translate to Swedish Translate to French Translate to German Translate to Spanish Translate to Italian
Change style: oceanic classic