-
Bug
-
Resolution: Fixed
-
P3
-
1.3.0
-
beta2
-
generic
-
generic
Name: krC82822 Date: 10/24/2000
24 Oct 2000, eval1127@eng -- this may simply be a doc error.
Solaris VM (build Solaris_JDK_1.2.2_05a, native threads, sunwjit)
and 1.3.0
--------------------
import java.util.* ;
import javax.swing.* ;
import javax.swing.text.* ;
public class TestStyle {
public static void main( String[] args ) {
StyleContext context = new StyleContext() ;
// enumerate the style names
Enumeration names = context.getStyleNames() ;
while( names.hasMoreElements() ) {
String name = ( String ) names.nextElement() ;
Style style = context.getStyle( name ) ;
// print the style name
System.out.println( "style: " + name ) ;
// enumerate the style's attribute names
Enumeration attribs = style.getAttributeNames() ;
while( attribs.hasMoreElements() ) {
// while the documentation claims this should be a string
// it actually returns a StyleConstants, what's up?
Object aname = attribs.nextElement() ;
System.out.println( "name = " +
aname.getClass().getName() + " => " +
aname ) ;
}
}
}
}
--
java TestStyle
-- output --
style: default
name = javax.swing.text.StyleConstants => name
--
pretty clear here that getAttributeNames is not returning names,
it returns a StyleConstant.
(Review ID: 110799)
======================================================================