This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 31732 - Cannot get attributes of Styled Document elements
Summary: Cannot get attributes of Styled Document elements
Status: RESOLVED DUPLICATE of bug 31694
Alias: None
Product: editor
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 3.x
Hardware: Sun SunOS
: P3 blocker (vote)
Assignee: issues@editor
URL:
Keywords: T9Y
Depends on:
Blocks:
 
Reported: 2003-03-06 11:09 UTC by elenas
Modified: 2007-11-05 13:44 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description elenas 2003-03-06 11:09:38 UTC
I test syntax highlighting in Source Editor for C++ source 
code.
I use Jemmy/Jelly API.
I need to recognize colors and font attributes of document 
elements but I cannot get them.
Please, see the following code:

import javax.swing.text.*;
import org.netbeans.jemmy.operators.*;
public class Main_1 {
        public static void main(String[] args) {
        JEditorPaneOperator editor = new 
JEditorPaneOperator(new JFrameOperator(), "public class 
Main_1");
        System.out.println(editor.getDocument().getClass
().getName());
        System.out.println(editor.getDocument() instanceof 
StyledDocument);
        int position = editor.getPositionByText("public 
class Main_1");
        System.out.println("Position=" + position);
        Element elem = ((StyledDocument)editor.getDocument
()).getCharacterElement(position + 1);
        System.out.println("Element=" + elem);
        System.out.println("ElementName=" + elem.getName
());
        System.out.println("Attributes=" + 
elem.getAttributes());
        System.out.println(StyleConstants.getForeground
(elem.getAttributes()));
    }
}

The getAttributes() method returns null.

Can I get attributes in some other way?

Product Version: NetBeans IDE 3.5 Beta (Build 20030304)
IDE Versioning:  IDE/1 spec=3.42 impl 20030304
OS: SunOS 5.8, sparc
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 
1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
Comment 1 Martin Roskanin 2003-03-06 12:53:38 UTC
This is already known problem, it is the duplicate of the issue
#31694. It seems the attribute persistency is broken.

*** This issue has been marked as a duplicate of 31694 ***