FULL PRODUCT VERSION : 1.4.2_10 J2SE 5.0 Update 6 and mustang b69 ADDITIONAL OS VERSION INFORMATION : Windows XP Professional SP1+ EXTRA RELEVANT SYSTEM CONFIGURATION : Not only Windows L&F A DESCRIPTION OF THE PROBLEM : the text of a JMenuitem will overlap with the shortcut key when set the text alignment to SwingConstants.RIGHT. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : package testbug; import java.awt.Dimension; import java.awt.Event; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.KeyStroke; import javax.swing.SwingConstants; import javax.swing.UIManager; public class TestFontBug extends JFrame { private JMenuBar menuBar = new JMenuBar(); private JMenu menuFile = new JMenu(); private JMenuItem jMenuItem1 = new JMenuItem(); public TestFontBug() { try { jbInit(); } catch (Exception e) { e.printStackTrace(); } } private void jbInit() throws Exception { this.setJMenuBar( menuBar ); this.getContentPane().setLayout( null ); this.setSize( new Dimension(400, 300) ); this.setTitle( "Bug For U" ); menuFile.setText( "File" ); jMenuItem1.setText("Test Shortcut"); jMenuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, Event.SHIFT_MASK | Event.CTRL_MASK | Event.ALT_MASK, false)); jMenuItem1.setHorizontalAlignment(SwingConstants.RIGHT); menuFile.add(jMenuItem1); menuBar.add(menuFile); } void fileExit_ActionPerformed(ActionEvent e) { System.exit(0); } public static void main(String[] argv){ TestFontBug bug = new TestFontBug(); bug.setVisible(true); } } REPRODUCIBILITY : This bug can be reproduced always.
|