-
Bug
-
Resolution: Fixed
-
P4
-
7
-
b110
-
x86
-
windows_7
FULL PRODUCT VERSION :
java version "1.7.0_02"
Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
Java HotSpot(TM) Client VM (build 22.0-b10, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
The method
public Rectangle getNormalBounds()
of the class
javax.swing.JInternalFrame
return stored value if JInternalFrame was iconified.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
User action in test case - minimize internal frame, restore internal frame, move internal frame;
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Output for last two calls should be the same.
ACTUAL -
internalFrameIconified - bounds=java.awt.Rectangle[x=0,y=0,width=200,height=200]
internalFrameIconified - normalBounds=java.awt.Rectangle[x=0,y=0,width=200,height=200]
internalFrameDeiconified - bounds=java.awt.Rectangle[x=0,y=0,width=200,height=200]
internalFrameDeiconified - normalBounds=java.awt.Rectangle[x=0,y=0,width=200,height=200]
componentMoved - bounds=java.awt.Rectangle[x=172,y=73,width=200,height=200]
componentMoved - normalBounds=java.awt.Rectangle[x=0,y=0,width=200,height=200]
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.text.MessageFormat;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
import javax.swing.event.InternalFrameAdapter;
import javax.swing.event.InternalFrameEvent;
public class NormalBoundsTest
{
public static void main(final String... pArgs)
{
SwingUtilities.invokeLater(new Runnable()
{
@Override
public void run()
{
new NormalBoundsTest().startup();
}
});
}
private JFrame mainFrame;
private JInternalFrame internalFrame;
public NormalBoundsTest()
{
internalFrame = new JInternalFrame("Internal", true, true, true, true);
internalFrame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
internalFrame.setSize(200, 200);
internalFrame.addComponentListener(new ComponentAdapter()
{
@Override
public void componentMoved(final ComponentEvent pEvent)
{
logBounds("componentMoved");
}
});
internalFrame.addInternalFrameListener(new InternalFrameAdapter()
{
@Override
public void internalFrameDeiconified(final InternalFrameEvent pEvent)
{
logBounds("internalFrameDeiconified");
}
@Override
public void internalFrameIconified(final InternalFrameEvent pEvent)
{
logBounds("internalFrameIconified");
}
});
JDesktopPane lDesktopPane = new JDesktopPane();
lDesktopPane.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
lDesktopPane.add(internalFrame);
mainFrame = new JFrame("Test");
mainFrame.setSize(640, 480);
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainFrame.setContentPane(lDesktopPane);
internalFrame.setVisible(true);
}
protected void logBounds(final String pName)
{
System.out.println(MessageFormat.format("{1} - bounds={0}", internalFrame.getBounds(), pName));
System.out.println(MessageFormat.format("{1} - normalBounds={0}", internalFrame.getNormalBounds(), pName));
}
protected void startup()
{
mainFrame.setVisible(true);
}
}
---------- END SOURCE ----------
java version "1.7.0_02"
Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
Java HotSpot(TM) Client VM (build 22.0-b10, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
The method
public Rectangle getNormalBounds()
of the class
javax.swing.JInternalFrame
return stored value if JInternalFrame was iconified.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
User action in test case - minimize internal frame, restore internal frame, move internal frame;
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Output for last two calls should be the same.
ACTUAL -
internalFrameIconified - bounds=java.awt.Rectangle[x=0,y=0,width=200,height=200]
internalFrameIconified - normalBounds=java.awt.Rectangle[x=0,y=0,width=200,height=200]
internalFrameDeiconified - bounds=java.awt.Rectangle[x=0,y=0,width=200,height=200]
internalFrameDeiconified - normalBounds=java.awt.Rectangle[x=0,y=0,width=200,height=200]
componentMoved - bounds=java.awt.Rectangle[x=172,y=73,width=200,height=200]
componentMoved - normalBounds=java.awt.Rectangle[x=0,y=0,width=200,height=200]
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.text.MessageFormat;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
import javax.swing.event.InternalFrameAdapter;
import javax.swing.event.InternalFrameEvent;
public class NormalBoundsTest
{
public static void main(final String... pArgs)
{
SwingUtilities.invokeLater(new Runnable()
{
@Override
public void run()
{
new NormalBoundsTest().startup();
}
});
}
private JFrame mainFrame;
private JInternalFrame internalFrame;
public NormalBoundsTest()
{
internalFrame = new JInternalFrame("Internal", true, true, true, true);
internalFrame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
internalFrame.setSize(200, 200);
internalFrame.addComponentListener(new ComponentAdapter()
{
@Override
public void componentMoved(final ComponentEvent pEvent)
{
logBounds("componentMoved");
}
});
internalFrame.addInternalFrameListener(new InternalFrameAdapter()
{
@Override
public void internalFrameDeiconified(final InternalFrameEvent pEvent)
{
logBounds("internalFrameDeiconified");
}
@Override
public void internalFrameIconified(final InternalFrameEvent pEvent)
{
logBounds("internalFrameIconified");
}
});
JDesktopPane lDesktopPane = new JDesktopPane();
lDesktopPane.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
lDesktopPane.add(internalFrame);
mainFrame = new JFrame("Test");
mainFrame.setSize(640, 480);
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainFrame.setContentPane(lDesktopPane);
internalFrame.setVisible(true);
}
protected void logBounds(final String pName)
{
System.out.println(MessageFormat.format("{1} - bounds={0}", internalFrame.getBounds(), pName));
System.out.println(MessageFormat.format("{1} - normalBounds={0}", internalFrame.getNormalBounds(), pName));
}
protected void startup()
{
mainFrame.setVisible(true);
}
}
---------- END SOURCE ----------