-
Bug
-
Resolution: Fixed
-
P4
-
1.4.1
-
tiger
-
x86
-
windows_xp
Name: jk109818 Date: 02/25/2003
FULL PRODUCT VERSION :
java version "1.4.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)
FULL OPERATING SYSTEM VERSION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
When using HTML to set the text for a JLabel, JRadioButton
or JCheckBox; mnemonics are never displayed, nor is the
visible focus indicator (i.e. dashed outline on Windows
L&F). If straight text (i.e. no HTML tags) are used,
everything displays just fine.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Compile the included source code.
2. Run the included source code.
3. Notice the component which use HTML do not have a
mnemonic or visible focus indication.
EXPECTED VERSUS ACTUAL BEHAVIOR :
I expect to see an underlined, mnemonic, character; but I don't.
I expect to see some sort of outline indicating the
component currently has focus; but I don't.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.event.KeyEvent;
import javax.swing.BoxLayout;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JRadioButton;
public class HTMLComponentLabelTest extends JFrame
{
public HTMLComponentLabelTest()
{
setDefaultCloseOperation( EXIT_ON_CLOSE );
JLabel label1 = new JLabel( "<html>This is a label test!</html>" );
label1.setDisplayedMnemonic( KeyEvent.VK_L );
label1.setDisplayedMnemonicIndex( 16 );
JLabel label2 = new JLabel( "This is a label test!" );
label2.setDisplayedMnemonic( KeyEvent.VK_L );
JCheckBox cb1 = new JCheckBox( "<html>This is a checkbox test!</html>" );
cb1.setMnemonic( KeyEvent.VK_C );
cb1.setDisplayedMnemonicIndex( 16 );
JCheckBox cb2 = new JCheckBox( "This is a checkbox test!" );
cb2.setMnemonic( KeyEvent.VK_C );
JRadioButton radio1 = new JRadioButton( "<html>This is a radiobutton
test!</html>" );
radio1.setMnemonic( KeyEvent.VK_R );
radio1.setDisplayedMnemonicIndex( 16 );
JRadioButton radio2 = new JRadioButton( "This is a radiobutton test!" );
radio2.setMnemonic( KeyEvent.VK_R );
getContentPane().
setLayout( new BoxLayout( getContentPane(), BoxLayout.Y_AXIS ) );
getContentPane().add( label1 );
getContentPane().add( label2 );
getContentPane().add( cb1 );
getContentPane().add( cb2 );
getContentPane().add( radio1 );
getContentPane().add( radio2 );
pack();
}
public static void main(String[] args)
{
HTMLComponentLabelTest frame = new HTMLComponentLabelTest();
frame.setVisible( true );
}
}
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
By changing the HTML from:
"<html>This is a checkbox test!</html>" to:
"<html>This is a <u>c</u>heckbox test!</html>"
I can display a pseudo mnemonic.
I haven't found a work around for the focus indicator.
(Review ID: 181722)
======================================================================
- relates to
-
JDK-4803316 JRadioButton that uses HTML does not show focus border
-
- Closed
-