Style in a JEDitorPane
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Surya_Prakash
Posted On:   Thursday, April 11, 2002 05:07 AM

Hello, ElementIterator it = new ElementIterator( document ); Element elem; while( ( elem = it.next() ) != null ) { System.out.print( elem.getName() ); if( elem.getName().equals( "ol") ) { SimpleAttributeSet sas = new SimpleAttributeSet(); StyleConstants.setBold( sas, true ); System.out.println(); System.out.println( document.getText( elem.getStartOffset(), elem.getEndOffset() - elem.getStartOffset() ) ); } } Now is it possible for me if element.getName().equals("ol") then i have to set the style of the tag to be bold. How can i do this.    More>>

Hello,


ElementIterator it = new ElementIterator( document );


Element elem;


while( ( elem = it.next() ) != null )
{

System.out.print( elem.getName() );

if( elem.getName().equals( "ol") )
{

SimpleAttributeSet sas = new SimpleAttributeSet();

StyleConstants.setBold( sas, true );

System.out.println();

System.out.println( document.getText( elem.getStartOffset(), elem.getEndOffset() - elem.getStartOffset() ) );
}

}


Now is it possible for me if element.getName().equals("ol")
then i have to set the style of the tag to be bold.

How can i do this.

Thanks.

reg,
suri.

   <<Less
About | Sitemap | Contact