-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
6
-
x86
-
linux
FULL PRODUCT VERSION :
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Server VM (build 1.6.0_01-b06, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux speedy 2.6.20.1mjs #3 SMP Mon May 14 11:22:25 CDT 2007 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
If a JPopupMenu is constructed with an icon and text items, the text items are located to the right of the right margin of the Icon item. The resulting popup menu is much wider than it needs to be, and text items are right-justified.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached program. Click in the window area and observe the popup menu.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A popup menu that is as wide as the icon.
ACTUAL -
A popup menu that is as wide as the icon+text width.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.Dimension;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.net.MalformedURLException;
import java.net.URL;
import javax.swing.*;
public class TestBug extends JFrame {
JPopupMenu jp;
public TestBug() {
jp=new JPopupMenu();
jp.add(new JMenuItem("Test"));
try {
jp.add(new JMenuItem(new ImageIcon(new URL("http://java.sun.com/images/featureart/dwnld_netbeans_off.gif"))));
} catch (MalformedURLException e1) {
e1.printStackTrace();
}
jp.add(new JMenuItem("Test"));
this.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
jp.show(TestBug.this,e.getX(),e.getY());
}
public void mouseReleased(MouseEvent e) {
jp.setVisible(false);
}
});
setMinimumSize(new Dimension(500,500));
setSize(new Dimension(500,500));
pack();
}
public static void main(String[] args) {
TestBug tb=new TestBug();
tb.setVisible(true);
}
}
---------- END SOURCE ----------
Release Regression From : 5.0u11
The above release value was the last known release where this
bug was not reproducible. Since then there has been a regression.
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Server VM (build 1.6.0_01-b06, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux speedy 2.6.20.1mjs #3 SMP Mon May 14 11:22:25 CDT 2007 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
If a JPopupMenu is constructed with an icon and text items, the text items are located to the right of the right margin of the Icon item. The resulting popup menu is much wider than it needs to be, and text items are right-justified.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached program. Click in the window area and observe the popup menu.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A popup menu that is as wide as the icon.
ACTUAL -
A popup menu that is as wide as the icon+text width.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.Dimension;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.net.MalformedURLException;
import java.net.URL;
import javax.swing.*;
public class TestBug extends JFrame {
JPopupMenu jp;
public TestBug() {
jp=new JPopupMenu();
jp.add(new JMenuItem("Test"));
try {
jp.add(new JMenuItem(new ImageIcon(new URL("http://java.sun.com/images/featureart/dwnld_netbeans_off.gif"))));
} catch (MalformedURLException e1) {
e1.printStackTrace();
}
jp.add(new JMenuItem("Test"));
this.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
jp.show(TestBug.this,e.getX(),e.getY());
}
public void mouseReleased(MouseEvent e) {
jp.setVisible(false);
}
});
setMinimumSize(new Dimension(500,500));
setSize(new Dimension(500,500));
pack();
}
public static void main(String[] args) {
TestBug tb=new TestBug();
tb.setVisible(true);
}
}
---------- END SOURCE ----------
Release Regression From : 5.0u11
The above release value was the last known release where this
bug was not reproducible. Since then there has been a regression.
- relates to
-
JDK-4729669 1.4 REGRESSION: Text edge of different types of JMenuItems are not aligned
- Resolved
-
JDK-6458123 Bugs in menu item layout
- Closed