mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-05-31 08:36:08 +00:00
Proper window screen centering
Graph dialog proper window size Graph dialog scroll speed increased
This commit is contained in:
@@ -30,6 +30,8 @@ import java.awt.Cursor;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Font;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.awt.Insets;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Toolkit;
|
||||
@@ -120,6 +122,7 @@ public class GraphDialog extends AppDialog {
|
||||
|
||||
setTitle(translate("graph") + " " + name);
|
||||
JScrollPane scrollPane = new JScrollPane(gp);
|
||||
scrollPane.getVerticalScrollBar().setUnitIncrement(20);
|
||||
scrollBarWidth = scrollPane.getVerticalScrollBar().getPreferredSize().width;
|
||||
scrollBarHeight = scrollPane.getHorizontalScrollBar().getPreferredSize().height;
|
||||
cnt.add(scrollPane, BorderLayout.CENTER);
|
||||
@@ -191,7 +194,9 @@ public class GraphDialog extends AppDialog {
|
||||
public void setVisible(boolean b) {
|
||||
|
||||
super.setVisible(b);
|
||||
Dimension screen = getToolkit().getScreenSize();
|
||||
Rectangle screenBounds = getGraphicsConfiguration().getBounds();
|
||||
Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(getGraphicsConfiguration());
|
||||
Dimension screen = new Dimension(screenBounds.width - insets.left - insets.right, screenBounds.height - insets.top - insets.bottom);
|
||||
Dimension dim = new Dimension(0, 0);
|
||||
Dimension panDim = gp.getPreferredSize();
|
||||
// add some magic constants
|
||||
@@ -203,13 +208,13 @@ public class GraphDialog extends AppDialog {
|
||||
if (panDim.width + frameWidthDiff < screen.width) {
|
||||
dim.width = panDim.width;
|
||||
} else {
|
||||
dim.width = screen.width;
|
||||
dim.width = screen.width - frameWidthDiff;
|
||||
tooWide = true;
|
||||
}
|
||||
if (panDim.height + frameHeightDiff < screen.height) {
|
||||
dim.height = panDim.height;
|
||||
} else {
|
||||
dim.height = screen.height;
|
||||
dim.height = screen.height - frameHeightDiff;
|
||||
tooHigh = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user