Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4382303

AttributeSet.getAttributeNames() returns non-String Enumeration

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.3.0
    • client-libs
    • 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)
      ======================================================================

            sharonz Sharon Zakhour (Inactive)
            kryansunw Kevin Ryan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: