-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
7u9
-
os_x
FULL PRODUCT VERSION :
java version " 1.7.0_09 "
Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64
A DESCRIPTION OF THE PROBLEM :
If the size of a JFrame is within 10 x 10 pixels of the available screen bounds then setting the framestate to Frame.MAXIMIZED_BOTH actually MINIMIZES the JFrame.
REGRESSION. Last worked in version 6u31
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached code snippet and observe that the JFrame is minimized when the frame state is set to Frame.MAXIMIZED_BOTH.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
JFrame stays at existing size
ACTUAL -
JFrame is minimized as much as the minimum layout size allows
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.Toolkit;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EmptyBorder;
public class MFrameMaximizationBugReport {
public static void main(final String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
final JFrame frame = new JFrame( " Frame " );
final JLabel label = new JLabel( " Hello world! " );
label.setFont(label.getFont().deriveFont(48.0f));
label.setBorder(new CompoundBorder(new EmptyBorder(15, 15, 15, 15), label.getBorder()));
frame.add(label);
final Toolkit toolkit = Toolkit.getDefaultToolkit();
final GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
final GraphicsDevice graphicsDevice = graphicsEnvironment.getDefaultScreenDevice();
final Dimension screenSize = toolkit.getScreenSize();
final Insets screenInsets = toolkit.getScreenInsets(graphicsDevice.getDefaultConfiguration());
final Rectangle availableScreenBounds = new Rectangle(screenSize);
availableScreenBounds.x += screenInsets.left;
availableScreenBounds.y += screenInsets.top;
availableScreenBounds.width -= (screenInsets.left + screenInsets.right);
availableScreenBounds.height -= (screenInsets.top + screenInsets.bottom);
frame.setBounds(availableScreenBounds.x, availableScreenBounds.y, availableScreenBounds.width, availableScreenBounds.height);
frame.setExtendedState(frame.getExtendedState() | Frame.MAXIMIZED_BOTH);
frame.setVisible(true);
}
});
}
}
---------- END SOURCE ----------
java version " 1.7.0_09 "
Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64
A DESCRIPTION OF THE PROBLEM :
If the size of a JFrame is within 10 x 10 pixels of the available screen bounds then setting the framestate to Frame.MAXIMIZED_BOTH actually MINIMIZES the JFrame.
REGRESSION. Last worked in version 6u31
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached code snippet and observe that the JFrame is minimized when the frame state is set to Frame.MAXIMIZED_BOTH.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
JFrame stays at existing size
ACTUAL -
JFrame is minimized as much as the minimum layout size allows
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.Toolkit;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EmptyBorder;
public class MFrameMaximizationBugReport {
public static void main(final String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
final JFrame frame = new JFrame( " Frame " );
final JLabel label = new JLabel( " Hello world! " );
label.setFont(label.getFont().deriveFont(48.0f));
label.setBorder(new CompoundBorder(new EmptyBorder(15, 15, 15, 15), label.getBorder()));
frame.add(label);
final Toolkit toolkit = Toolkit.getDefaultToolkit();
final GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
final GraphicsDevice graphicsDevice = graphicsEnvironment.getDefaultScreenDevice();
final Dimension screenSize = toolkit.getScreenSize();
final Insets screenInsets = toolkit.getScreenInsets(graphicsDevice.getDefaultConfiguration());
final Rectangle availableScreenBounds = new Rectangle(screenSize);
availableScreenBounds.x += screenInsets.left;
availableScreenBounds.y += screenInsets.top;
availableScreenBounds.width -= (screenInsets.left + screenInsets.right);
availableScreenBounds.height -= (screenInsets.top + screenInsets.bottom);
frame.setBounds(availableScreenBounds.x, availableScreenBounds.y, availableScreenBounds.width, availableScreenBounds.height);
frame.setExtendedState(frame.getExtendedState() | Frame.MAXIMIZED_BOTH);
frame.setVisible(true);
}
});
}
}
---------- END SOURCE ----------
- duplicates
-
JDK-8007219 [macosx] Frame size reverts meaning of maximized attribute if frame size close to display
- Resolved