-
Bug
-
Resolution: Fixed
-
P3
-
1.3.0
-
beta
-
generic
-
generic
Name: boT120536 Date: 01/04/2001
C:\>java -version
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
/** The code I had sent you is not part of my real program; it is only a
simplified test that also shows the bug.
First of all, there is no mention in the documentation that prohibits
implementing a visual object with a JRootPane inside it.
I implemented a visual ?DockableWindow? object.
The object contains JRootPane as it only child.
A user can ?undock? it and then it looks like JWindow, or a user can ?dock? it
inside a container and it looks like container component.
This class works fine in our applications, but when the ?DockableWindow? is in
its ?docked? state, all popups (popup menu, combo box, tool tips) do not work
properly as I described in the ?submit?.
I think that there are actually two bugs.
1. Cutting lightweight popups by JRootPane bounds.
2. Tooltip does not work for ?heavyweight? (JComboBox and JPopupMenu work Ok)
.
I think that my problem is not similar to bug 4251869 as tool tip now works in
most cases, unlike the situation mentioned there.
All kinds of popup do not work properly with JRootPane layered inside other
container.
/*
* PopupWithJRootPane.java
*
* Created on September 13, 2000, 9:22 AM
*/
package vg.tests.bugsubmit;
/**
*
* @author michael
* @version
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class PopupWithJRootPane
{
JComboBox cb = null;
JButton butt = null;
public static void main(String[] arg)
{
new PopupWithJRootPane();
}
public PopupWithJRootPane()
{
JFrame frame = new JFrame("PopupWithJRootPaneTest");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JRootPane rp = new JRootPane();
frame.getContentPane().add(rp);
rp.getContentPane().setLayout(new FlowLayout());
String[] cont = {"111111","222222","333333","444444","555555","666666"};
cb = new JComboBox(cont);
// remove comment from next line for heavyWeightPopupEnabled
// cb.setLightWeightPopupEnabled(false);
rp.getContentPane().add(cb);
butt = new JButton("butt");
rp.getContentPane().add(butt);
butt.setToolTipText("1111111111111111111");
// remove comment from next line for heavyWeightPopupEnabled
// ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
ToolTipManager.sharedInstance().registerComponent(butt);
butt.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent evt)
{
JPopupMenu popup = new JPopupMenu();
// remove comment from next line for heavyWeightPopupEnabled
// popup.setLightWeightPopupEnabled(false);
JMenuItem mitem;
popup.add(mitem = new JMenuItem("11111"));
popup.add(mitem = new JMenuItem("22222"));
popup.add(mitem = new JMenuItem("33333"));
popup.add(mitem = new JMenuItem("44444"));
popup.add(mitem = new JMenuItem("55555"));
popup.show(butt,0,0);
}
});
JPanel np = new JPanel();
np.setPreferredSize(new Dimension(100,50));
frame.getContentPane().add(np,BorderLayout.NORTH);
np.setBackground(Color.red);
JPanel sp = new JPanel();
sp.setPreferredSize(new Dimension(100,50));
frame.getContentPane().add(sp,BorderLayout.SOUTH);
sp.setBackground(Color.green);
JPanel ep = new JPanel();
ep.setPreferredSize(new Dimension(50,100));
frame.getContentPane().add(ep,BorderLayout.EAST);
ep.setBackground(Color.blue);
JPanel wp = new JPanel();
wp.setPreferredSize(new Dimension(50,100));
frame.getContentPane().add(wp,BorderLayout.WEST);
wp.setBackground(Color.white);
frame.pack();
frame.setVisible(true);
}
}
(Review ID: 110437)
======================================================================