-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
8u131
-
x86_64
-
solaris_10
FULL PRODUCT VERSION :
java version "1.8.0_141"
Java(TM) SE Runtime Environment (build 1.8.0_141-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.141-b15, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
OS X 10.11.6
A DESCRIPTION OF THE PROBLEM :
MacBooks (and maybe other Apple hardware) has a touchpad where you can use a two finger (gesture) to scroll, and when clicking with two fingers it acts as a "right click". The same stands for two finger tapping.
From version (at least) 1.8.131 up to 1.8.141 (or maybe higher) there is a bug in the JRE where using the two finger click (or tap) after scrolling with two fingers fails: instead of right click action first a scroll action were fired, than the right click.
This is a very annoying bug, as on MacBook users likely to use two-finger scroll with two-finger right-click. But instead of selecting the clicked item, the tree is scrolled, and an item above or below is selected instead.
Scroll is observer in both up and down and some times in the horizontal directions as well.
REGRESSION. Last worked in version 8u121
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Add a JScrollPanel, add a JTree with a good amount of items.
Scroll with two fingers, click on two fingers.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No scroll before right-click event arrives.
ACTUAL -
Tree will likely to jump one item up or down.
REPRODUCIBILITY :
This bug can be reproduced often.
---------- BEGIN SOURCE ----------
import java.util.UUID;
import javax.swing.*;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
public class ScrollTest extends JDialog implements TreeSelectionListener
{
public static void main(String[] args)
{
ScrollTest dialog = new ScrollTest();
dialog.setModal(true);
dialog.pack();
dialog.setVisible(true);
System.exit(0);
}
public ScrollTest()
{
DefaultMutableTreeNode top =
new DefaultMutableTreeNode("The Java Series");
createNodes(top);
JTree tree = new JTree(top);
for (int i = 0; i < tree.getRowCount(); i++) {
tree.expandRow(i);
}
JScrollPane treeView = new JScrollPane(tree);
this.add(treeView);
}
private void createNodes(DefaultMutableTreeNode top)
{
for (int c = 0; c < 5; c++)
{
DefaultMutableTreeNode category;
category = new DefaultMutableTreeNode(
"Cat #" + c + " - Books for Java Programmers");
top.add(category);
for (int n = 0; n < 30; n++)
{
DefaultMutableTreeNode book =
new DefaultMutableTreeNode(
"Node #" + n + " " + UUID.randomUUID().toString());
category.add(book);
}
}
}
@Override
public void valueChanged(TreeSelectionEvent e)
{
System.out.println(e.getPath());
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use an external mouse.
java version "1.8.0_141"
Java(TM) SE Runtime Environment (build 1.8.0_141-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.141-b15, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
OS X 10.11.6
A DESCRIPTION OF THE PROBLEM :
MacBooks (and maybe other Apple hardware) has a touchpad where you can use a two finger (gesture) to scroll, and when clicking with two fingers it acts as a "right click". The same stands for two finger tapping.
From version (at least) 1.8.131 up to 1.8.141 (or maybe higher) there is a bug in the JRE where using the two finger click (or tap) after scrolling with two fingers fails: instead of right click action first a scroll action were fired, than the right click.
This is a very annoying bug, as on MacBook users likely to use two-finger scroll with two-finger right-click. But instead of selecting the clicked item, the tree is scrolled, and an item above or below is selected instead.
Scroll is observer in both up and down and some times in the horizontal directions as well.
REGRESSION. Last worked in version 8u121
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Add a JScrollPanel, add a JTree with a good amount of items.
Scroll with two fingers, click on two fingers.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No scroll before right-click event arrives.
ACTUAL -
Tree will likely to jump one item up or down.
REPRODUCIBILITY :
This bug can be reproduced often.
---------- BEGIN SOURCE ----------
import java.util.UUID;
import javax.swing.*;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
public class ScrollTest extends JDialog implements TreeSelectionListener
{
public static void main(String[] args)
{
ScrollTest dialog = new ScrollTest();
dialog.setModal(true);
dialog.pack();
dialog.setVisible(true);
System.exit(0);
}
public ScrollTest()
{
DefaultMutableTreeNode top =
new DefaultMutableTreeNode("The Java Series");
createNodes(top);
JTree tree = new JTree(top);
for (int i = 0; i < tree.getRowCount(); i++) {
tree.expandRow(i);
}
JScrollPane treeView = new JScrollPane(tree);
this.add(treeView);
}
private void createNodes(DefaultMutableTreeNode top)
{
for (int c = 0; c < 5; c++)
{
DefaultMutableTreeNode category;
category = new DefaultMutableTreeNode(
"Cat #" + c + " - Books for Java Programmers");
top.add(category);
for (int n = 0; n < 30; n++)
{
DefaultMutableTreeNode book =
new DefaultMutableTreeNode(
"Node #" + n + " " + UUID.randomUUID().toString());
category.add(book);
}
}
}
@Override
public void valueChanged(TreeSelectionEvent e)
{
System.out.println(e.getPath());
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use an external mouse.
- duplicates
-
JDK-8173876 [macosx] Fast precise scrolling and DeltaAccumulator fix for macOS Sierra 10.12.2
-
- Resolved
-