Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4036120
Votes 3
Synopsis toFront() forces visibility inconsistantly
Category java:classes_awt
Reported Against 1.1
Release Fixed
State 11-Closed, duplicate of 4094565, bug
Priority: 4-Low
Related Bugs 4094565
Submit Date 04-MAR-1997
Description




The toFront() method makes a window visible in an unconsistent
manner.

toFront() changes the stacking order, which is one thing, and 
show() shows it and setVisible() sets it to be visible. The 
problem appears to be that toFront() does a show (which it 
shouldn't anyway) but does not setVisible().

======================================================================
Work Around





======================================================================
Evaluation
This appears to only effect Solaris versions.  The Window.toFront causes a hinden window to be displayed and then it is unable to hide it.

With this test application.

1. Press the Create Button
2. Press Show Button
<Window in upper left hand corner appears - good>
3. Press Hide Button
<Window in upper left hand corner disappears - good>
4. Press toFront Button
<Window in upper left hand corner appears - bad>
5. Press Hide Button
<Window in upper left hand corner stays - bad>

It appears the Window.toFront() is missing up the visability state.

zWindow.java
---------------------------------

import java.awt.*;
import java.awt.event.*;

class zWindowFrame extends Frame
{
	zWindowFrame()
	{
		setLayout(new FlowLayout());

		Button createButton = new Button("Create");
		add(createButton);
		createButton.addActionListener(
			new ActionListener()
			{
				public void actionPerformed(ActionEvent e)
				{
					onCreate();
				}
			}
		);

		Button showButton = new Button("Show");
		add(showButton);
		showButton.addActionListener(
			new ActionListener()
			{
				public void actionPerformed(ActionEvent e)
				{
					onShow();
				}
			}
		);

		Button hideButton = new Button("Hide");
		add(hideButton);
		hideButton.addActionListener(
			new ActionListener()
			{
				public void actionPerformed(ActionEvent e)
				{
					onHide();
				}
			}
		);

		Button toFrontButton = new Button("toFront");
		add(toFrontButton);
		toFrontButton.addActionListener(
			new ActionListener()
			{
				public void actionPerformed(ActionEvent e)
				{
					onToFront();
				}
			}
		);

		Button toBackButton = new Button("toBack");
		add(toBackButton);
		toBackButton.addActionListener(
			new ActionListener()
			{
				public void actionPerformed(ActionEvent e)
				{
					onToBack();
				}
			}
		);

		addWindowListener(
			new WindowAdapter()
			{
				public void windowClosing(WindowEvent e)
				{
					System.exit(0);
				}
			}
		);
	}

	void onCreate()
	{
		if (window == null)
		{
			window = new Window(this);
			window.setBounds(0,0,64,64);
		}
	}

	void onShow()
	{
		if (window != null)
		{
			window.show();
		}
	}

	void onHide()
	{
		if (window != null)
		{
			window.hide();
		}
	}

	void onToFront()
	{
		if (window != null)
		{
			window.toFront();
		}
	}

	void onToBack()
	{
		if (window != null)
		{
			window.toBack();
		}
	}

	Window	window = null;
}

public class zWindow
{
	public static void main(String[] args)
	{
		Frame frame = new zWindowFrame();
		frame.setBounds(100,100,320,200);
		frame.show();
	}
}
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang