JDK-6203528 : Frame does not disappear with setVisible(false) when changing workspace
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 5.0
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: linux
  • CPU: x86
  • Submitted: 2004-12-03
  • Updated: 2011-04-28
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)


ADDITIONAL OS VERSION INFORMATION :
Linux beoulw006 2.4.18-14 #1 Wed Sep 4 13:35:50 EDT 2002 i686 i686 i386 GNU/Linux


EXTRA RELEVANT SYSTEM CONFIGURATION :
Sun Ultra-5 workstation

A DESCRIPTION OF THE PROBLEM :
On a small GUI application this is what happens.

The main Frame creates a new frame, I let it sleep or do something no matter what, after this is will automatically disappear using setVisible(false);
This goes ok if you keep in your current workspace.
If you start the new frame, switch to another workspace and do not come back before you are sure the new frame should be automatically disappeared, you see the new frame in an idle sort of way. You cannot destroy it, your main application you can use without any problem, you can resize the idle frame.

It is not blocking but annoying.

It does not occur when I run my application on a linux pc. Then the spawned frame normally disappears after it has done it's work.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Don't change workspace and no problem occurs.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The spawned frame should disappear.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;

import java.io.*;
import java.util.*;

public class CompleteRun extends JFrame
  {
  public static final int WIDTH  = 650;
  public static final int HEIGHT = 450;
  public static String TITLE  = "Main Menu of TAMTAM";

  private JMenuBar menuBar = new JMenuBar();
  private JMenu projectMenu = new JMenu("Project");
  private JMenu testMenu = new JMenu("Test");
  private JMenu exitMenu = new JMenu("Quit");
  private JMenuItem projectNewMenuItem = new JMenuItem("New");
  private JMenuItem toetNewMenuItem = new JMenuItem("Toet");
  private JMenuItem exitMenuItem = new JMenuItem("Quit");
  private JLabel plainLabel = new JLabel("Plain Small Label");
  private JLabel fancyLabel = new JLabel("Fancy Big Label");
  private Font fancyFont = new Font("Serif", Font.BOLD | Font.ITALIC, 32);

  public static void main(String args[])
    {
    try
      {
      CompleteRun ex = new CompleteRun();

      ex.buildWindow();
      ex.handleProjectMenuEvents();
      ex.showWindow();

      }
    catch (Exception e)
      {
      e.printStackTrace();
      }
    }

  public CompleteRun()
    {
    }

  private void buildWindow()
    {
    Container frameContainer;
    frameContainer = getContentPane();
    JPanel panelke = new JPanel();
    frameContainer.setLayout(new BorderLayout());
    panelke.setLayout(new FlowLayout());
    projectMenu.add(projectNewMenuItem);
    testMenu.add(toetNewMenuItem);
    exitMenu.add(exitMenuItem);
    projectMenu.addSeparator();
    menuBar.add(projectMenu);
    menuBar.add(testMenu);
    menuBar.add(exitMenu);
    menuBar.setBorder(BorderFactory.createLineBorder(Color.gray));
    menuBar.setEnabled(true);
    setJMenuBar(menuBar);
    panelke.add(plainLabel);
    fancyLabel.setFont(fancyFont);
    fancyLabel.setHorizontalAlignment(JLabel.RIGHT);
    panelke.add(fancyLabel);
    panelke.setEnabled(true);
    frameContainer.add(panelke,BorderLayout.SOUTH);
    setSize(800,800);
    }

  private void showWindow()
    {
    setVisible(true);
    }

  private void handleProjectMenuEvents() throws Exception
    {
    try
      {
      projectNewMenuItem.addActionListener(new ActionListener()
        {
        public void actionPerformed(ActionEvent e)
          {
          onNewProject();
          }
        });

      toetNewMenuItem.addActionListener(new ActionListener()
        {
        public void actionPerformed(ActionEvent e)
          {
          onToet();
          }
        });

      exitMenuItem.addActionListener(new ActionListener()
        {
        public void actionPerformed(ActionEvent e)
          {
          String title = "Exit UserTool";
          System.exit(0);
          }
        });

      }
    catch(Exception e2)
      {
      System.out.println("Test:handleProjectMenuEvents:");
      e2.printStackTrace();
      }
    }


  private void onNewProject()
    {
    String title = "New Project";
    boolean tryToLoad = true;

    try
      {
	  NewFrame newFrame = new NewFrame();
          newFrame.showWindow();
      }
    catch(Exception e2)
      {
      System.out.println("Exception Caught in CompleteRun.onNewProject()");
      }
    }

  private void onToet()
    {
    String javaforkPath   = System.getProperty("PATH");
    String javaforkLdPath = System.getProperty("LD_LIBRARY_PATH");

    String executeFile =  "/disk/tamtam2/develop.linux/execjavafork " + javaforkPath + " " + javaforkLdPath + " " +
                          "/homedirs/hautew/batchpipe /disk/tamtam2/develop.linux/completerun" + " " + "/disk/tamtam2/develop.linux/Tamtam2" + " " +
                          "/disk/tamtamtest/tamtam2/j750/guitest/tamtam" + "/" + "setup.tts0" + " " + "/disk/tamtamtest/tamtam2/j750/guitest/tamtam" + " " +
                          "/disk/tamtamtest/tamtam2/j750/guitest/tamtam/.logging/.completerunstatus.txt" + " ";
    try
      {
      System.err.println("Started: " + executeFile);
      Process process = Runtime.getRuntime().exec(executeFile);
      process.waitFor();
      }
    catch(Exception e2)
      {
      System.out.println("Exception Caught in CompleteRun.onNewProject()");
      }
    }


  }

----



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

import java.io.*;
import java.util.*;

public class NewFrame extends JFrame
  {
  public static final int WIDTH  = 650;
  public static final int HEIGHT = 450;
  public static String TITLE  = "New Frame TAMTAM";


  public void CompleteRun()
    {
    buildWindow();
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    }

  private void buildWindow()
    {
    Container frameContainer;
    frameContainer = getContentPane();
    setSize(1000,1000);
    }

  public void showWindow()
    {
    setVisible(true);
    try
      {
      Thread.currentThread().sleep(5000);
      setVisible(false);
      }
    catch(Exception ex)
      {
      System.err.println("ex thrown");
      }
      
    }
  }

---------- END SOURCE ----------


Comments
EVALUATION Reproducible on Solaris 10_b63 with Mustang b24 with XToolkit enabled. This is XAWT-specific problem. It also exist in JDK5.0b60. Seems that this bug is not reproducible on GNOME. Seen only on CDE (I use CDE 1.6_63) environment. ###@###.### 2005-2-22 10:44:41 GMT
22-02-2005