-
Bug
-
Resolution: Fixed
-
P3
-
1.3.0
-
beta
-
x86
-
windows_98
Name: krT82822 Date: 02/19/2000
2/19/2000 eval1127@eng -- Definitely a kestrel regression or new bug (fine on 1.2.2).
May just be a symptom of JMenu not fully "going away" after being dismissed.
Depending on which node you pick in the tree before opening the menu, the menu's left edge
seems to extend invisibly (but destrucitvely) down to the same "lattitude/altitude" as the tree
node you have just selected], erasing any tree connector-lines in its path. Lines reappear after next resize/repaint.
Noticed user hadn't included a pack(), so added that...problem INITIALLY disappeared, but then when I did a resize of the
window, followed by the steps-to-reproduce above, the problem recurred.
If you cannot quickly reproduce this, do the following:
a) start the app
b) before ANYTHING else, resize the window to be larger (width-wise) than it is initially shown
c) select the bottom tree node
d) open the menu
------------------------
java version "1.3.0rc1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc1-T)
Java HotSpot(TM) Client VM (build 1.3.0rc1-S, mixed mode)
Steps to reproduce the problem:
1. Run the attached test case
2. Click on the tree node "Here"
3. Click on the menu "Menu"
On my computer, this lets the line connecting the nodes
"Bug" and "Here" disappear. Clicking on the different
tree nodes also causes mysterious dots to appear below
the handle of the "Duke" node. I don't think I saw
this effect in 1.2.2.
--
import java.awt.*;
import javax.swing.*;
import javax.swing.tree.*;
public class TreePaintBug extends JFrame {
public TreePaintBug() {
JMenuBar mb = new JMenuBar();
// needed to exactly align left edge of menu and angled line of tree
mb.add(Box.createHorizontalStrut(27));
JMenu mn = new JMenu("Menu");
JMenuItem mi = new JMenuItem("MenuItem");
mn.add(mi);
mb.add(mn);
setJMenuBar(mb);
DefaultMutableTreeNode n1 = new DefaultMutableTreeNode("Root");
DefaultMutableTreeNode n2 = new DefaultMutableTreeNode("Duke");
n1.add(n2);
DefaultMutableTreeNode n3 = new DefaultMutableTreeNode("Bug");
n2.add(n3);
n3.add(new DefaultMutableTreeNode("Blah"));
n3.add(new DefaultMutableTreeNode("Blah"));
n3.add(new DefaultMutableTreeNode("Blah"));
DefaultMutableTreeNode n4 = new DefaultMutableTreeNode("Here");
n2.add(n4);
JTree tree = new JTree(new DefaultTreeModel(n1));
tree.putClientProperty("JTree.lineStyle", "Angled");
tree.expandPath(new TreePath(new Object[] {n1, n2, n3}));
setContentPane(tree);
setSize(new Dimension(300, 300));
setLocation((getToolkit().getScreenSize().width - getWidth()) / 2,
((getToolkit().getScreenSize().height) - getHeight()) / 2);
pack(); // eval1127: this eliminates the anomaly INITIALLY, but anomaly reappears if you resize tree and repeat steps
setVisible(true);
}
public static void main(String[] args) {
new TreePaintBug();
}
}
(Review ID: 101255)
======================================================================