# HG changeset patch # User David Barts # Date 1595033935 25200 # Node ID 9129ae1101466cbaab1b744afe5510a1de9bb00b # Parent 884f1415a3300ff80cd47d211234264f430d8da0 Window reshapes to avoid gratuitous scrollbars (as it should). diff -r 884f1415a330 -r 9129ae110146 src/name/blackcap/imageprep/RotateDialog.kt --- a/src/name/blackcap/imageprep/RotateDialog.kt Fri Jul 17 17:11:43 2020 -0700 +++ b/src/name/blackcap/imageprep/RotateDialog.kt Fri Jul 17 17:58:55 2020 -0700 @@ -7,6 +7,7 @@ import java.awt.Graphics import java.awt.Graphics2D import java.awt.RenderingHints +import java.awt.Toolkit import java.awt.event.ActionListener import java.awt.image.BufferedImage import java.io.File @@ -20,8 +21,6 @@ class RotateDialog(val file: File, initialImage: BufferedImage) : JDialog(Application.mainFrame) { private val BW = 9 private val BW2 = BW * 2 - private val MINWIDTH = 512 - private val MINHEIGHT = 384 private class DrawingPane(initialImage: BufferedImage) : JPanel() { var image: BufferedImage = initialImage @@ -31,7 +30,11 @@ repaint() } - override fun getPreferredSize() = Dimension(image.width, image.height) + override fun getPreferredSize(): Dimension { + val screen = Toolkit.getDefaultToolkit().screenSize + return Dimension(min(image.width, screen.width/4*3), + min(image.height, screen.height/4*3)) + } override protected fun paintComponent(g: Graphics): Unit { g.drawImage(image, 0, 0, null) @@ -76,6 +79,9 @@ dispose() } drawingPane.image = rotatedImage + revalidate() + pack() + repaint() } init {