0

I have build a ANTLR3 swing application, My problem is how to display tree of my file in graph My code is like this

Antlr3JavaParser parser = new Antlr3JavaParser(tokens);
CommonTree tree;
try {
    tree = (CommonTree) parser.compilationUnit().getTree();
    DOTTreeGenerator gen = new DOTTreeGenerator();
    StringTemplate st = gen.toDOT(tree);

  TextAreaParseTree.setText(st.toString()); // This my text area

    } catch (RecognitionException e) {
        e.printStackTrace();
        return false;
    }

which is give me an output like

This is my screeshot application https://www.dropbox.com/s/iulr9htjmn5i441/Stack.png

How Can I make this code to be looked a graph (perhaps an image) like in https://www.dropbox.com/s/i50oq8rir66wvce/DIkitLagi.png

Thank you so much

Fadly Massere
  • 107
  • 1
  • 1
  • 8
  • This question doesn't have anything to do with ANTLR or StringTemplate. You might have better results asking how you can render a GraphViz graph for display in a Swing application. – Sam Harwell Jun 01 '14 at 19:22
  • This question is also a duplicate of: http://stackoverflow.com/questions/18991143/visualize-tree-from-dot-file – Sam Harwell Jun 01 '14 at 19:25

0 Answers0