JDK-4418849 : The disposing JFrame does not dispose separated JToolBar
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.2.2,1.3.0,1.4.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux,solaris_2.6,windows_2000
  • CPU: x86,sparc
  • Submitted: 2001-02-26
  • Updated: 2001-07-25
  • Resolved: 2001-07-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.0 beta2Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description

Name: dsR10051			Date: 02/26/2001


If one disposes JFrame containing drugged out JToolBar then JToolBar is
not disposed with JFrame and, therefore, still remains on the screen. This
behavior is incorrect since the orphan window is useless.

Here is a minimized test:
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.Dimension;

public class ToolBarExample extends JPanel {

    public static void main(String s[]) {

        JToolBar toolBar = new JToolBar();
        toolBar.setOrientation(1);
        toolBar.setPreferredSize(new Dimension(100,50));

        JFrame frame = new JFrame("ToolBar Example");
        frame.getContentPane().add(toolBar, BorderLayout.WEST);
        frame.setSize(new Dimension(150, 95));
        frame.pack();
        frame.setVisible(true);

        System.out.println("Drag please");
        try {
            Thread.sleep(20000);
        } catch (Exception eee) {
        }
        System.out.println("frame dispose");
        frame.dispose();
    }
}

Drug out toolBar to separate window and wait for frame is disposed.

======================================================================

Name: yyT116575			Date: 04/30/2001


java version "1.3.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0_02)
Java HotSpot(TM) Client VM (build 1.3.0_02, mixed mode)

Source code for the reproduction of this bug follows.  To reproduce, do the
following:

1.  Run the application.
2.  Drag the toolbar so that it floats in a separate window.
3.  Close the main window (not the toolbar window).  The toolbar window remains open.


import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/*
 *
 */
public class TestPersistentToolbar {
  public static void main(String[] args) {
    openWindow();
  }
  public static void openWindow() {
    JToolBar tb = new JToolBar();
	
    JButton b = new JButton("Open Another");
    b.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        openWindow();
      }
    });
	
    tb.add(b);
	
    JButton b2 = new JButton("Exit Application");
    b2.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        System.exit(0);
      }
    });
	
    tb.add(b2);
	
    JFrame f = new JFrame();
    f.setSize(400, 400);
    f.getContentPane().add(tb, BorderLayout.NORTH);
    f.setVisible(true);
  }
}
(Review ID: 123502)
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: merlin-beta2 FIXED IN: merlin-beta2 INTEGRATED IN: merlin-beta2
14-06-2004

EVALUATION Merlin now uses JDialog instead of JFrame for the floating toolbar. See bug 4231629. However, the dialog needs to perented to the frame of the toolbar. leif.samuelsson@Eng 2001-07-12
12-07-2001