mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-25 10:15:46 +00:00
opening dialogs on same screen as the main window, do not restore window size to larger value that actual screen size Fixed [#1768], [#1768] Maximizing window on other than main monitor
This commit is contained in:
@@ -22,6 +22,10 @@ import com.jpexs.helpers.Helper;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GraphicsDevice;
|
||||
import java.awt.Insets;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
@@ -63,12 +67,17 @@ public final class MainFrameClassic extends AppFrame implements MainFrame {
|
||||
|
||||
int w = Configuration.guiWindowWidth.get();
|
||||
int h = Configuration.guiWindowHeight.get();
|
||||
Dimension dim = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
|
||||
if (w > dim.width) {
|
||||
w = dim.width;
|
||||
GraphicsDevice device = View.getMainDefaultScreenDevice();
|
||||
Rectangle bounds = device.getDefaultConfiguration().getBounds();
|
||||
Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(device.getDefaultConfiguration());
|
||||
int maxWidth = bounds.width - (insets.left + insets.right);
|
||||
int maxHeight = bounds.height - (insets.top + insets.bottom);
|
||||
|
||||
if (w > maxWidth) {
|
||||
w = maxWidth;
|
||||
}
|
||||
if (h > dim.height) {
|
||||
h = dim.height;
|
||||
if (h > maxHeight) {
|
||||
h = maxHeight;
|
||||
}
|
||||
setSize(w, h);
|
||||
|
||||
@@ -116,7 +125,7 @@ public final class MainFrameClassic extends AppFrame implements MainFrame {
|
||||
cnt.setLayout(new BorderLayout());
|
||||
cnt.add(panel);
|
||||
|
||||
View.centerScreen(this);
|
||||
View.centerScreenMain(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user