-
Bug
-
Resolution: Cannot Reproduce
-
P3
-
8, 9
-
x86
-
os_x
FULL PRODUCT VERSION :
java version "1.8.0_71"
Java(TM) SE Runtime Environment (build 1.8.0_71-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.71-b15, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Darwin Kernel Version 15.0.0: Sat Sep 19 15:53:46 PDT 2015; root:xnu-3247.10.11~1/RELEASE_X86_64 x86_64
EXTRA RELEVANT SYSTEM CONFIGURATION :
MacBook Pro (Retina, 15-inch, Mid 2014)
Graphics Intel Iris Pro 1536 MB
A DESCRIPTION OF THE PROBLEM :
I am displaying a menu when clicking a button, and the menu items have tooltips (having tooltips is important; without tooltips the problem doesn't happen). When hovering over the items, in 1-2 seconds the menu loses focus and the tooltip does not get displayed.
REGRESSION. Last worked in version 6u45
ADDITIONAL REGRESSION INFORMATION:
I actually have a Java 1.6.0_65-b14-468 on which I tested.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Click button
2. Hover over menu item which has tooltip (the first one)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The tooltip should be shown and the highlight shown when hovering should not disappear.
ACTUAL -
The menu loses focus (at least the highlight shown when hovering disappears) and the tooltip does not get displayed.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.Component;
import java.awt.GridBagLayout;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
public class LetsPlay extends JFrame {
JButton jb;
JPopupMenu menu;
JMenuItem m1, m2, m3;
public LetsPlay() {
createAndShowGUI();
}
private void createAndShowGUI() {
// Set frame properties
setTitle("Menu Button");
setLayout(new GridBagLayout());
setDefaultCloseOperation(EXIT_ON_CLOSE);
// Create JButtons
jb = new JButton("Button");
// Create a JPopupMenu
menu = new JPopupMenu();
// Create JMenuItems
m1 = new JMenuItem("Item 1");
m1.setToolTipText("Extra info 1");
m2 = new JMenuItem("Item 2");
m3 = new JMenuItem("Item 3");
// Add JMenuItems to JPopupMenu
menu.add(m1);
menu.add(m2);
menu.add(m3);
// Create an ActionListener
ActionListener a1 = new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
showPopup(ae);
}
};
// Add ActionListener to JButtons
jb.addActionListener(a1);
// Add the JButtons
add(jb);
// Set some size and show
setSize(400, 400);
setVisible(true);
}
// This method does it all!
private void showPopup(ActionEvent ae) {
// Get the event source
Component b = (Component) ae.getSource();
// Get the location of the point 'on the screen'
Point p = b.getLocationOnScreen();
menu.show(this, 0, 0);
// Now set the location of the JPopupMenu
// This location is relative to the screen
menu.setLocation(p.x, p.y + b.getHeight());
}
/**
*
* @param args
*/
public static void main(String args[]) {
new LetsPlay();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No workaround.
java version "1.8.0_71"
Java(TM) SE Runtime Environment (build 1.8.0_71-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.71-b15, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Darwin Kernel Version 15.0.0: Sat Sep 19 15:53:46 PDT 2015; root:xnu-3247.10.11~1/RELEASE_X86_64 x86_64
EXTRA RELEVANT SYSTEM CONFIGURATION :
MacBook Pro (Retina, 15-inch, Mid 2014)
Graphics Intel Iris Pro 1536 MB
A DESCRIPTION OF THE PROBLEM :
I am displaying a menu when clicking a button, and the menu items have tooltips (having tooltips is important; without tooltips the problem doesn't happen). When hovering over the items, in 1-2 seconds the menu loses focus and the tooltip does not get displayed.
REGRESSION. Last worked in version 6u45
ADDITIONAL REGRESSION INFORMATION:
I actually have a Java 1.6.0_65-b14-468 on which I tested.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Click button
2. Hover over menu item which has tooltip (the first one)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The tooltip should be shown and the highlight shown when hovering should not disappear.
ACTUAL -
The menu loses focus (at least the highlight shown when hovering disappears) and the tooltip does not get displayed.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.Component;
import java.awt.GridBagLayout;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
public class LetsPlay extends JFrame {
JButton jb;
JPopupMenu menu;
JMenuItem m1, m2, m3;
public LetsPlay() {
createAndShowGUI();
}
private void createAndShowGUI() {
// Set frame properties
setTitle("Menu Button");
setLayout(new GridBagLayout());
setDefaultCloseOperation(EXIT_ON_CLOSE);
// Create JButtons
jb = new JButton("Button");
// Create a JPopupMenu
menu = new JPopupMenu();
// Create JMenuItems
m1 = new JMenuItem("Item 1");
m1.setToolTipText("Extra info 1");
m2 = new JMenuItem("Item 2");
m3 = new JMenuItem("Item 3");
// Add JMenuItems to JPopupMenu
menu.add(m1);
menu.add(m2);
menu.add(m3);
// Create an ActionListener
ActionListener a1 = new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
showPopup(ae);
}
};
// Add ActionListener to JButtons
jb.addActionListener(a1);
// Add the JButtons
add(jb);
// Set some size and show
setSize(400, 400);
setVisible(true);
}
// This method does it all!
private void showPopup(ActionEvent ae) {
// Get the event source
Component b = (Component) ae.getSource();
// Get the location of the point 'on the screen'
Point p = b.getLocationOnScreen();
menu.show(this, 0, 0);
// Now set the location of the JPopupMenu
// This location is relative to the screen
menu.setLocation(p.x, p.y + b.getHeight());
}
/**
*
* @param args
*/
public static void main(String args[]) {
new LetsPlay();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No workaround.