JTextPane &  XML highlighter

Hello,
I wrote an XML Viewer via JTextPane.
Unfortunately I don't know how to implement a good XML highlighter.
I wrote an own code using the regulary expression.
With the regulary expression I can get the "startPosition" and "endPosition"
of pattern I am searching for within a text.
StyledDocument xmlDoc;
xmlDoc.setCharacterAttributes(startPosition, length,  style, true);It is working very good for xml files up to ca. 1000 ... 1200 lines.
But for bigger files it takes too long until the highlighting took place.
1) Is there another faster mechanism to highlight xml files?
2) How do I wrap / unwrap the horizontal display without re-reading or re-highlighting the xml file again?
Thanks Aykut

Interesting. I will keep that in mind.
I have more or less got what i need working now - just smoothing out some bumps.
Extending DefaultHighlighter cannot help much as to override paint() is near impossible because required info is private in the superclass :(
But I could hold my own highlight info there for one highlight type and paint those first before calling super.paint(). Looking back, I should have replaced the whole highlight system - that would have been easier and neater.

Similar Messages

  • JTextPane and highlighting

    Hello!
    Here's what I'm trying to do: I have a window that needs to display String data which is constantly being pumped in from a background thread. Each String that comes in represents either "sent" or "recieved" data. The customer wants to see sent and recieved data together, but needs a way to differentiate between them. Since the Strings are being concatinated together into a JTextPane, I need to highlight the background of each String with a color that represents whether it is "sent" (red) or "recieved" (blue) data. Should be easy right? Well, not really...
    Before I describe the problem I'm having, here is a small example of my highlighting code for reference:
         private DefaultStyledDocument doc = new DefaultStyledDocument();
         private JTextPane txtTest = new JTextPane(doc);
         private Random random = new Random();
         private void appendLong() throws BadLocationException {
              String str = "00 A9 10 20 20 50 10 39 69 FF F9 00 20 11 99 33 00 6E ";
              int start = doc.getLength();
              doc.insertString(doc.getLength(), str, null);
              int end = doc.getLength();
              txtTest.getHighlighter().addHighlight(start, end, new DefaultHighlighter.DefaultHighlightPainter(randomColor()));
         private Color randomColor() {
              int r = intRand(0, 255);
              int g = intRand(0, 255);
              int b = intRand(0, 255);
              return new Color(r, g, b);
         private int intRand(int low, int hi) {
              return random.nextInt(hi - low + 1) + low;
         }As you can see, what I'm trying to do is append a String to the JTextPane and highlight the new String with a random color (for testing). But this code doesn't work as expected. The first String works great, but every subsequent String I append seems to inherit the same highlight color as the first one. So with this code the entire document contents will be highlighted with the same color.
    I can fix this problem by changing the insert line to this:
    doc.insertString(doc.getLength()+1, str, null);With that change in place, every new String gets its own color and it all works great - except that now there's a newline character at the beginning of the document which creates a blank line at the top of the JTextPane and makes it look like I didn't process some of the incomming data.
    I've tried in veign to hack that newline character away. For example:
              if (doc.getLength() == 0) {
                   doc.insertString(doc.getLength(), str, null);
              } else {
                   doc.insertString(doc.getLength()+1, str, null);
              } But that causes the 2nd String to begin on a whole new line, instead of continuing on the first line like it should. All the subsequent appends work good though.
    I've also tried:
    txtTest.setText(txtTest.getText()+str);That makes all the text line up correctly, but then all the previous highlighting is lost. The only String that's ever highlighted is the last one.
    I'm getting close to submitting a bug report on this, but I should see if anyone here can help first. Any ideas are much appreciated!

    It may work but it is nowhere near the correct
    solution.It seems to me the "correct" solution would be for Sun to fix the issue, because it seems they are secretly inserting a newline character into my Document. Here's a compilable program that shows what I mean:
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.EventQueue;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.util.Random;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTextPane;
    import javax.swing.text.BadLocationException;
    import javax.swing.text.DefaultHighlighter;
    import javax.swing.text.DefaultStyledDocument;
    public class TestFrame extends JFrame {
         private JButton btnAppend = new JButton("Append");
         private DefaultStyledDocument doc = new DefaultStyledDocument();
         private JTextPane txtPane = new JTextPane(doc);
         private Random random = new Random();
         public TestFrame() {
              setSize(640, 480);
              setLocationRelativeTo(null);
              addWindowListener(new WindowAdapter() {
                   public void windowClosing(WindowEvent e) {
                        dispose();
              getContentPane().add(new JScrollPane(txtPane), BorderLayout.CENTER);
              getContentPane().add(btnAppend, BorderLayout.SOUTH);
              btnAppend.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        doBtnAppend();
         private void doBtnAppend() {
              try {
                   String str = "00 A9 10 20 20 50 10 39 69 FF F9 00 20 11 99 33 00 6E ";
                   int start = doc.getLength();
                    * This line causes all highlights to have the same color,
                    * but the text correctly starts on the first line.
                   doc.insertString(doc.getLength(), str, null);
                    * This line causes all highlights to have the correct
                    * (different) colors, but the text incorrectly starts
                    * on the 2nd line.
    //               doc.insertString(doc.getLength()+1, str, null);
                    * This if/else solution causes the 2nd appended text to
                    * incorrectly start on the 2nd line, instead of being
                    * concatinated with the existing text on the first line.
                    * (a newline character is somehow inserted after the first
                    * line)
    //               if (doc.getLength() == 0) {
    //                    doc.insertString(doc.getLength(), str, null);
    //               } else {
    //                    doc.insertString(doc.getLength()+1, str, null);
                   int end = doc.getLength();
                   txtPane.getHighlighter().addHighlight(start, end, new DefaultHighlighter.DefaultHighlightPainter(randomColor()));
              } catch (BadLocationException e) {
                   e.printStackTrace();
         public static void main(String[] args) {
              EventQueue.invokeLater(new Runnable() {
                   public void run() {
                        new TestFrame().setVisible(true);
         private Color randomColor() { return new Color(intRand(0, 255), intRand(0, 255), intRand(0, 255)); }
         private int intRand(int low, int high) { return random.nextInt(high - low + 1) + low; }
    }Try each of the document insert lines in the doBtnAppend method and watch what it does. (comment out the other 2 of course)
    It wastes resources and is inefficient. A lot of work
    goes on behind the scenes to create and populate a
    Document.I tracked the start and end times in a thread loop to benchmark it, and most of the time the difference is 0 ms. When the document gets to about 7000 characters I start seeing delays on the order of 60 ms, but I'm stripping off text from the beginning to limit the max size to 10000. It might be worse on slower computers, but without a "correct" and working solution it's the best I can come up with. =)

  • JTextPane Line Highlighting

    Hi.
    I have a JTextPane, and I would like to make it highlight a whole row, or line, that the cursor is on.
    I DON'T want to set the selection color. I want the current row that is selected to highlight the background of the text for the whole width of the row, then unhighlight it when it is deselected.
    Please help.
    Thanks!

    Note: This thread was originally posted in the [Java Programming|http://forums.sun.com/forum.jspa?forumID=31] forum, but moved to this forum for closer topic alignment.

  • XML highlighting blocks: another poor Jiveware feature

    Reason number 234073874 why these forums stink.
    If this were correctly highlighted for an XML syntax like I selected, shouldn't the commented out tags display with the comment color regardless of their content?  This can get to be a (admittedly minor) pain when posting larger xml blocks.
              <!-- Whether the window is initially visible. Optional. Default false. -->
              <!-- <visible></visible> -->
              <!-- Whether the user can minimize the window. Optional. Default true. -->
              <!-- <minimizable></minimizable> -->
              <!-- Whether the user can maximize the window. Optional. Default true. -->
              <!-- <maximizable></maximizable> -->
    Why, yes.  Yes I do believe they should be colored differently, like this:
    <!-- Whether the window is initially visible. Optional. Default false. -->
    <!-- <visible></visible> -->
    <!-- Whether the user can minimize the window. Optional. Default true. -->
    <!-- <minimizable></minimizable> -->
    <!-- Whether the user can maximize the window. Optional. Default true. -->
    <!-- <maximizable></maximizable> -->

    Hi Eric,
    Thanks for the suggestion,the Enhancement request has been made.
    Thanks
    ineet

  • JTextPane Colour Highlighting

    Im doing up a prototype of a compiler, i have certain keywords like "if"s and "elses" etc etc which i would like to be colour coded differently!!! My problem is when i have big files the time it takes to colour code and display is horrendous!!! I just want to know am i going about the right way in highlighting my keywords?? is there a better way or how can i improve my current code!!! any suggestions at all are welcome!! heres a sample of code..
    public class MyDoc extends DefaultStyledDocument
    static MutableAttributeSet setAttr, ifAttr, defaultAttr;
    public MyDoc()
    setAttr = new SimpleAttributeSet();
    StyleConstants.setForeground(setAttr, Color.red);
    ifAttr = new SimpleAttributeSet();
    StyleConstants.setForeground(ifAttr, Color.blue);
    defaultAttr = new SimpleAttributeSet();
    StyleConstants.setForeground(defaultAttr, Color.black);
    public void insertString(int offs, String str, AttributeSet a) throws
    BadLocationException
    if (str == null) return;
    StringTokenizer tokenizer = new StringTokenizer(str," \n",true);
    try
    while( tokenizer.hasMoreTokens())
    String token = (String)tokenizer.nextElement();
    if(token.length() == 0)
    continue;
    if (token.compareTo("set") == 0)
    super.insertString(offs, token, setAttr);
    } else if (token.compareTo("if") == 0)
    super.insertString(offs, token, ifAttr);
    } else
    super.insertString(offs,token, defaultAttr);
    offs = offs + token.length();
    } catch (BadLocationException ble)
    System.err.println("MyDoc::insertString()"+ble.toString());
    }catch(Exception e)
    System.err.println("MyDoc::insertString()"+e.toString());
    bottom line is that im looking for some other way, more elegant way of getting keywords highlighted, the above is nasty!!!
    cheers people,
    JB.

    I have tried a couple of different approaches for using threads:
    1) Load the data into the text pane and then use a thread for highlighting. The highlighting got messed up if you type data in the text pane while the highlighting thread is working. This approach won't work with the current structure of the SyntaxDocument.
    2) Load data into the text pane in smaller pieces. This approach shows a little more promise as the text pane is shown with initial data in a couple of seconds. However, the entire load time goes from 15 to 26 seconds. During this 26 second load time you can type data and scroll, but the text pane reacts very slowly. I haven't verified that data inserted into the document by typing does not cause problems with data being loaded into the document by the background thread. (Swing components are not thread safe, but hopefully insertion of data into the document is). Here is the test class:
    import java.awt.*;
    import java.io.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.text.*;
    public class LoadTextPane extends JFrame
         char[] data;
         JTextPane textPane;
         public LoadTextPane(String fileName)
              EditorKit editorKit = new StyledEditorKit()
                   public Document createDefaultDocument()
                        return new SyntaxDocument();
              textPane = new JTextPane();
             textPane.setEditorKitForContentType("text/java", editorKit);
             textPane.setContentType("text/java");
              JScrollPane sp = new JScrollPane(textPane);
              getContentPane().add( sp );
              long startTime = new Date().getTime();
              try
                   File f = new File( fileName );
                   FileReader in = new FileReader( f );
                   int size = (int) f.length();
                   data = new char[ size ];
                   int chars_read = 0;
                   while( chars_read < size )
                        chars_read += in.read( data, chars_read, size - chars_read );
                   in.close();
                   long endTime=new Date().getTime();
                   System.out.println( "File size: " + chars_read );
                   // System.out.println( data );
              catch (IOException sse)
                   System.out.println("Error has occured"+sse);
              System.out.println( "Time to read file: " + (new Date().getTime() - startTime ));
              if (data.length > 8092)
                   Thread load = new LoadThread(data, textPane.getDocument());
                   load.start();
              else
                   textPane.setText( new String(data, 0, data.length) );
         public static void main( String[] args )
              String fileName = "c:/java/jdk1.3/src/java/awt/Component.java";
              JFrame f = new LoadTextPane(fileName);
              f.setDefaultCloseOperation( EXIT_ON_CLOSE );
              f.setSize( 1000, 600);
              f.setVisible(true);
         class LoadThread extends Thread
              char[] data;
              Document doc;
              LoadThread(char[] data, Document doc)
                   this.data = data;
                   this.doc = doc;
              public void run()
                  int start = 0;
                  int end = data.length;
                  int increment = 8192;
                   long begin = System.currentTimeMillis();
                  while ( start < end )
                       if (start + increment > end)
                            increment = end - start;
                       String text = new String(data, start, increment);
                       try
                            doc.insertString(doc.getLength(), text, null);
                       catch(BadLocationException e)
                            System.out.println(e);
                       start += increment;
                        //  allow some time for the gui to process typed text, scrolling etc
    //                    try { Thread.sleep(300); }
    //                    catch (Exception e) {}
                   System.out.println( "Load Text Pane: " + (System.currentTimeMillis() - begin) );
    }

  • XML  highlight

    Hi,
    I just wrote a little visual application.
    - User selects an XML file
    - Pressing the "read" button reads the bad formatted xml file and
    displays it in the textarea field as "pretty formatted", so with nice indent.
    until here everything is ok.
    I would like to have a "free" java API, which emphasize the XML-Tags.
    Or is there any other way of doing this?
    thanks
    Aykut

    Well. 1 out of two (Free): Emacs.
    Also still free I think, but not small, IBM's XML editor. I forget the name. It's on developerworks somewhere.
    Mike
    null

  • JTextPane selection Highlighting

    I have got a next problem.
    I have got text editor that uses JTextPane. When I select text and try change font (choose ComboBox with Font names) my text selection is hide and I mush execute textPane.grabFocus(); to take back selection.
    How can I make so as this selection is not hide?

    Check out this thread:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=317332

  • PDF + PowerPoint dimensions issue

    Hi All-
    I have come across a weird bug today, when a PPT is saved as a PDF, the dimension attribute for the slide is a portrate mode (540x720), the actual slide is 720x540, and although it will preview properly, when this PDF is uploaded to an iOS device, the device displays the image rotated 90 degrees.
    The issue can be solved by opening the PDF and rotating it 360 degreees (this appears to reset the dimensions), but that is a pain. Is there some setting when th PDF is created to set it to Landscape view?
    Below you can see the dimensions of my PPT before and after rotating the same slide....
    Thanks for taking the time to look, and for your help.

    Michael,
    MII doesn't throw any error and no output is generated. Understand a simple SQL Query result set when passed directly works fine and the table is generated. But in my case iam calling another transaction which in turns call a JCO interface to ECC.The result xml set is absolutely fine and when passing the same to the PDF table action there is no output generated.
    For the error "Index: n, Size: n" can u plz try to add a text or a horizontal line to the pdf prior to passing the result set.
    However I have noticed that the output doesn't get generated when there exists a single row. I have included a dummy row to the XML highlighted in my previous post and it works fine. Try and add the below xml with 2 rows as a transaction property xml and pass it to the table action block and it works fine.
    <?xml version="1.0" encoding="UTF-8"?><Rowsets><Rowset><Columns><Column Description="Operator_Comments" MaxRange="1" MinRange="0" Name="Operator_Comments" SQLDataType="1" SourceColumn="Operator_Comments"/><Column Description="Supervisor_Comments" MaxRange="1" MinRange="0" Name="Supervisor_Comments" SQLDataType="1" SourceColumn="Supervisor_Comments"/><Column Description="Planner_Comments" MaxRange="1" MinRange="0" Name="Planner_Comments" SQLDataType="1" SourceColumn="Planner_Comments"/></Columns><Row><Operator_Comments/><Supervisor_Comments/><Planner_Comments/></Row><Row><Operator_Comments/><Supervisor_Comments/><Planner_Comments/></Row></Rowset></Rowsets>
    kind of strange but not sure whts the reason..
    thanks,
    Gilmour

  • Should not happen unless default context failed to deploy

              Can somebody please throw some light on this error?
              <Mar 5, 2001 10:07:26 AM EST> <Error> <HTTP> <HttpServer5173817,null
              default ctx,POSDev01) found no context for "GET /classes/ringout_statelessSession3@/RingoutSessionBeanHomeImpl_WLStub.class
              HTTP/1.0". This should not happen unless the default context failed
              to deploy.>
              Myself and lot of other people in my team are getting this error
              when using beans in a cluster.
              I am getting this error consistently whenever I make some code
              changes in my bean class (not interface changes) and redeploy it
              and try to lookup through a stand-alone client.
              The only way I could find to overcome this problem is:
              1) edit config.xml to remove the Application element completely
              corresponding to the bean
              2) remove jar files from the applications directory
              3) re-deploy and run the client again.
              Thanks a lot
              Kiran Ganuthula
              

    Partly it could be WLS problem also. Under any circumstances default webapp should be able
              to deploy. I have seen somebody else also reported the same problem. The current problem is
              if you delete anything from apps dir, the corresponding entry is not being deleted from config.xml
              So next time when you boot the server, it tries to deploy the webapp and eventually it fails.
              I 'm not sure if this is the situation in your case.
              In anycase somehow Targets tag is not being picking up. That's why i asked you add
              "WebServers" tag. I think we have done some major changes in SP1, to make sure that
              default webapp deploys all the times.
              If you still have problems, post it to servlet or management group, we will discuss there.
              Kumar
              Kiran G wrote:
              > I edited the config.xml ONLY after getting this error. And, it worked.
              >
              > BTW, can you please be more specific about the changes to config.xml
              > to solve the problem?
              > If possible, can you give pertinent portion(s) of config.xml, highlighting
              > the changes.
              >
              > Thanks
              > Kiran G
              >
              > Kumar Allamraju <[email protected]> wrote:
              > >
              > >
              > >It appears your "default webapp" failed to deploy.
              > >Did you messed up with the config.xml?.
              > >
              > >Add the following to your default webapp tag?
              > >
              > ><Application
              > > Deployed="true"
              > > Name="DefaultWebApp_vindev1"
              > > Path="./config/vindev1/applications"
              > > >
              > > <WebAppComponent
              > > Name="DefaultWebApp_vindev1"
              > > Targets="vindev1"
              > > WebServers="vindev1"
              > > URI="DefaultWebApp_vindev1"
              > > />
              > > </Application>
              > >
              > >
              > >Here vindev1 is my domain's name..
              > >
              > >BTW, this is not a clustering question. So you better
              > >post it to servlet newsgroup where you get much
              > >better answers..
              > >
              > >Kiran G wrote:
              > >
              > >> I forgot to give these details about the problem.
              > >> I am running this cluster using WebLogic 6.0 on a SUN
              > >sparc machine.
              > >>
              > >> The error text given in my original posting appears
              > >in the managed
              > >> weblogic server's log. The exception that the client
              > >receives while
              > >> lookup is :
              > >>
              > >> javax.naming.CommunicationException. Root exception
              > >is java.rmi.UnmarshalException:
              > >> failed to unmarshal class java.lang.Object; nested exception
              > >is:
              > >> java.lang.ClassNotFoundException: RingoutSessionBeanHomeImpl_WLStub
              > >> java.lang.ClassNotFoundException: RingoutSessionBeanHomeImpl_WLStub
              > >>
              > >> "Kiran G" <[email protected]> wrote:
              > >> >
              > >> >Can somebody please throw some light on this error?
              > >> >
              > >> ><Mar 5, 2001 10:07:26 AM EST> <Error> <HTTP> <HttpServer5173817,null
              > >> >default ctx,POSDev01) found no context for "GET /classes/ringout_statelessSession3@/RingoutSessionBeanHomeImpl_WLStub.class
              > >> >HTTP/1.0". This should not happen unless the default
              > >context
              > >> >failed
              > >> >to deploy.>
              > >> >
              > >> >Myself and lot of other people in my team are getting
              > >> >this error
              > >> >when using beans in a cluster.
              > >> >
              > >> >I am getting this error consistently whenever I make
              > >some
              > >> >code
              > >> >changes in my bean class (not interface changes) and
              > >redeploy
              > >> >it
              > >> >and try to lookup through a stand-alone client.
              > >> >
              > >> >The only way I could find to overcome this problem
              > >is:
              > >> >1) edit config.xml to remove the Application element
              > >completely
              > >> >corresponding to the bean
              > >> >2) remove jar files from the applications directory
              > >> >3) re-deploy and run the client again.
              > >> >
              > >> >Thanks a lot
              > >> >Kiran Ganuthula
              > >> >
              > >> >
              > >> >
              > >> >
              > >> >
              > >
              > >
              > ><!doctype html public "-//w3c//dtd html 4.0 transitional//en">
              > ><html>
              > >It appears your "default webapp" failed to deploy.
              > ><br>Did you messed up with the config.xml?.
              > ><p>Add the following to your default webapp tag?
              > ><p><Application
              > ><br> Deployed="true"
              > ><br> Name="DefaultWebApp_vindev1"
              > ><br> Path="./config/vindev1/applications"
              > ><br> >
              > ><br> <WebAppComponent
              > ><br> Name="DefaultWebApp_vindev1"
              > ><br> Targets="vindev1"
              > ><br> <b><font color="#CC0000">
              > >WebServers="vindev1"</font></b>
              > ><br> URI="DefaultWebApp_vindev1"
              > ><br> />
              > ><br> </Application>
              > ><br>
              > ><p>Here vindev1 is my domain's name..
              > ><br><br>
              > >BTW, this is not a clustering question. So you better
              > >post it to servlet
              > >newsgroup where you get much
              > ><br>better answers..
              > ><p>Kiran G wrote:
              > ><blockquote TYPE=CITE>I forgot to give these details about
              > >the problem.
              > ><br>I am running this cluster using WebLogic 6.0 on a
              > >SUN sparc machine.
              > ><p>The error text given in my original posting appears
              > >in the managed
              > ><br>weblogic server's log. The exception that the client
              > >receives while
              > ><br>lookup is :
              > ><p>javax.naming.CommunicationException. Root exception
              > >is java.rmi.UnmarshalException:
              > ><br>failed to unmarshal class java.lang.Object; nested
              > >exception is:
              > ><br> java.lang.ClassNotFoundException:
              > >RingoutSessionBeanHomeImpl_WLStub
              > ><br>java.lang.ClassNotFoundException: RingoutSessionBeanHomeImpl_WLStub
              > ><p>"Kiran G" <[email protected]> wrote:
              > ><br>>
              > ><br>>Can somebody please throw some light on this error?
              > ><br>>
              > ><br>><Mar 5, 2001 10:07:26 AM EST> <Error> <HTTP>
              > ><HttpServer5173817,null
              > ><br>>default ctx,POSDev01) found no context for "GET /classes/ringout_statelessSession3@/RingoutSessionBeanHomeImpl_WLStub.class
              > ><br>>HTTP/1.0". This should not happen unless the default
              > >context
              > ><br>>failed
              > ><br>>to deploy.>
              > ><br>>
              > ><br>>Myself and lot of other people in my team are getting
              > ><br>>this error
              > ><br>>when using beans in a cluster.
              > ><br>>
              > ><br>>I am getting this error consistently whenever I make
              > >some
              > ><br>>code
              > ><br>>changes in my bean class (not interface changes)
              > >and redeploy
              > ><br>>it
              > ><br>>and try to lookup through a stand-alone client.
              > ><br>>
              > ><br>>The only way I could find to overcome this problem
              > >is:
              > ><br>>1) edit config.xml to remove the Application element
              > >completely
              > ><br>>corresponding to the bean
              > ><br>>2) remove jar files from the applications directory
              > ><br>>3) re-deploy and run the client again.
              > ><br>>
              > ><br>>Thanks a lot
              > ><br>>Kiran Ganuthula
              > ><br>>
              > ><br>>
              > ><br>>
              > ><br>>
              > ><br>></blockquote>
              > ></html>
              > >
              > >
              [att1.html]
              

  • Set color in TextArea for certain String

    I need to highlight some Strings in different color than the setForeground() in the TextArea. Is it possible and how can I accomplish it?
    Help is great appreciated.
    Anna

    I am able to use JTextPane to highlight certain string now.
    Thanks a lot.
    Though I am having problem on mouse double click on a file name.
    For TextArea, the getSelectedText() will pick the full path name of the file. For JTextPane, the selected text is just part of the string.
    Following is the text:
    Test report is saved in file C:\tests\pf2150\JTAG\888_test.rpt
    The file name is
    C:\tests\pf2150\JTAG\888_test.rpt
    My mouse is over the file name but double click only picks JTAG or pf2150 or ...
    Could anybody help?
    Anna

  • Help required in syntax highlighting in xml using tool Syntax

    hi
    i am using Syntax tool for syntax highlighting of xml in JTextpane. I use complex html style and i want to change the colors of the displayed xml in the tool under complex html like the internet explorer displays in case of xml i want to make my xml like that..

    Hi,
    use it like this if Fname equals constnat[space] then pass the Constant[space] to Fname else value of Fname as under
    ................................Constant[]------>
    FNAME.............................................Then
    >Equals....................................IF -
    >FNAME
    Constant[].........................................ELSE
    .......................................FNAME---->   
    Constant[]    = Constant [ Space ]
    Sachin

  • XML Syntax highlighting (again :)

    Hi there,
    I know, that there have been quite a view posts about this topics, but as far as I see, there has been no solution to this.
    So I wanted to ask if someone has implemented a XML Syntax highlighting or knows where to get a tutorial from to accomplish so (inheriting from DefaultStyledDocument...?)
    Sincerely
    Charly

    Hi!
    I have the same need: an XML Syntax Highlighting (coloring).
    I don't need an XML editor, I have a JTextPane that shows XML code and I would like it to be done with a syntax coloring.
    If you have a solution I will really appreciate!
    Thanks
    Gio :-)

  • Printing XML report (with report.xsl stylesheet) shows font colors, but not table highlight colors

    I am trying to print the XML report generated by TestStand to a PDF in order to archive it.  When the XML report is rendered in Internet Explorer, everything looks fine -- Sequence names are highlighted in teal, Pass is in green, Fail is highlighted in red.
    However, when I print this page to a PDF (using BullZip PDF printer, or even the XPS printer), all of the table highlighting is gone.  The UUT Result in the header is red or green font color depending on the pass/fail state, but sequence names and any formatting applied to tables within the body of the report have no highlighting.
    Is the stylesheet altering what is rendered when the XML file is printed?
    This is the output when viewed in IE 
    This is the output when viewed as a PDF printed from the same file viewed in IE.
    Thank you,
    Matt
    Solved!
    Go to Solution.

    Hey Matt,
    This is actually because of a default setting in Internet Explorer to not print background colors on webpages. To change it, simply go to the Page Setup screen (on IE9, you click the gear icon, then Print > Page Setup) and select the option to print background images and colors. After doing this, the printed report should contain the colors you see on your screen.
    Daniel E.
    TestStand Product Support Engineer
    National Instruments

  • Applying color to a value(word) in xml to highlight in webpage

    Hello All
    Im not sure if that is even the proper headline for my question but here it goes. I have an Excel spreadsheet that I export as xml to update a webpage. What I would like is when the word "High" is in the Priority column I would like it highlighted red. I tried going with some form of javascript like:
    var currDiv;
    var foreColor;
    currDiv= document.Priority("High");
    foreColor = currDiv.style.backgroundColor;
    alert(foreColor);
    I am unsure if thats the path I need to go down... anyone know how I can make the word "High" red when displayed on my webpage if chosen via excel export to xml?
    THanks
    Im using Spry data set too if that helps
    Rob

    Heya,
    wrap the contents of the xml tag in CDATA then use CSS to style the word "high" to red text.
    An example of an xml tag with embedded CDATA will look like this:
    <tag><![CDATA[Something here. <span style="color:#FF0000;">high</span> is styled in red.]]></tag>
    And it will render like this:
    Something here. high is styled in red.
    What version of spry are you using? Spry after 1.5 has to set the "html" column type. Look here for more info and examples.

  • JTextPane - getting the color of the highlighted text

    Ok, I have a JTextPane that accepts typing input from the user. I need to know how to highlight a string and recover its font color.
    For example, if my JTextPane contained the sentence {color:#ff0000}This{color} {color:#0000ff}is{color} {color:#008000}an{color} {color:#ff6600}example{color} with those colors I want to be able to highlight the word "This", press a button, and have the program tell me that this string is red in RBG style. Likewise, I want to also be able to highlight the word "is" and return that color of blue in RBG format. I tried google searching this problem but I have had no luck. If anyone here has had experience with this or knows a way to do this I would very much appriciate it.
    Error trapping for selecting more then 2 strings with different colors will not be a problem so don't worry about it. I just need to know how to do the above request.
    Edited by: Naked-Crook on Jul 26, 2008 12:37 AM
    nevermind, I figured it out. Topic closed.

    Here is a simple conversion for you:
    BufferedImage bi = new BufferedImage(myImage, myImage.getWidth(null), myImage.getHeight(null), BufferedImage.TYPE_INT_RGB);
    Graphics g = bi.getGraphics():
    g.drawImage(myImage, 0, 0, null);If you are using ImageObserver objects, then replace null with the corresponding ImageObserver object in the BufferedImage and drawImage.

Maybe you are looking for

  • How can I convert 16bit greyscale pictures to 24bit color pictures

    Hi, I am stuck at coloring 16bit greyscale pictures without losing the resolution of 16bit, as it would happen when using the WindMapping-thing (which reduces the displayed resolution to 8bit). I figured that what I would need is probably an array co

  • How can I delete all my junk mail or a large number of emails in one go?

    Please can someone tell me if I can delete all the mail in my junk or a large number of mail (100+) in go? I'm so fed up of spending 5-10 mins just selected each mail and deleting it one by one! Please help or apple update ASAP. Even old school phone

  • "No accounting document created"

    I just implemented an SAP system and was configuring it for a Customer management process. During the sales order process I get n error " No accounting document created".  I want to configure the system for automatic release of accounting documents.

  • Removing JScrollPane column header

    Hi I have created a JScrollPane containg a table. JTable d_pointDataTable; JScrollPane pointDataPane; d_pointDataTable = new JTable(15,15); d_pointDataPane      = new JScrollPane(d_pointDataTable); But my scroll pane appears with a column header as A

  • Palm Desktop address file problem

    I recently reinstalled Palm Desktop software which is running fine. But when I try to import address book folder which was previously saved, I get an error message telling me it is "not an address book archive file or is corrupt" I have tried to impo