JDK-6472860 : toFront() works inconsistently on SUSE Linux 10.0
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2006-09-20
  • Updated: 2011-02-16
  • Resolved: 2006-09-20
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
JDK 1.5.0_08 

ADDITIONAL OS VERSION INFORMATION :
Linux 2.6.13-15-default #1 Tue Sep 13 14:56:15 UTC 2005 i686 i686 i386 GNU/Linux

EXTRA RELEVANT SYSTEM CONFIGURATION :
SUSE Linux 10.0

A DESCRIPTION OF THE PROBLEM :
A visible frame on which toFront() is called does not always come to front of the application's other frames.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
An application has several JFrames.
Frame B is partially behind frame A.
Frame A is active (visible).
setVisible(true) + toFront() are called on frame B.
Frame B becomes active.  But it does not always go to front (as it should).  Sometimes (seemingly depending on frame A's and frame B's relative positions on the screen) it stays behind frame A.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A visible frame on which toFront() is called should always come to front and not stay behind the application's other frames.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
// Test example with 3 frames

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class FrameToFrontTest extends JFrame
{
	JFrame frame1 = new SubFrame(100, 200);
	JFrame frame2 = new SubFrame(400, 300);

	public FrameToFrontTest() throws HeadlessException
	{
		super();

		JPanel panel = new JPanel();
		JButton button1 = new JButton("1 - to front");
		button1.addActionListener(new ActionListener(){

			public void actionPerformed(ActionEvent e)
			{
				frame1.setVisible(true);
				frame1.toFront();
			}
		});
		panel.add(button1);
		JButton button2 = new JButton("2 - to front");
		button2.addActionListener(new ActionListener(){

			public void actionPerformed(ActionEvent e)
			{
				frame2.setVisible(true);
				frame2.toFront();
			}
		});
		panel.add(button2);

		getContentPane().add(panel);

		setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
		pack();
		setVisible(true);
	}

	public static void main(String[] args)
	{
		new FrameToFrontTest();
	}

	class SubFrame extends JFrame
	{
		public SubFrame(int x, int y) throws HeadlessException
		{
			super();
			setSize(300, 200);
			setLocation(x, y);
		}
	}
} 
---------- END SOURCE ----------

Comments
EVALUATION The bug seems to be a duplicate of 6472274.
20-09-2006