Created
May 30, 2018 13:02
-
-
Save eduardosan/6a4976bd61ea956f1409353129d65ed3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//show AST in GUI | |
JFrame frame = new JFrame("Antlr AST"); | |
JPanel panel = new JPanel(); | |
JScrollPane scrollPane = new JScrollPane(panel); | |
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); | |
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); | |
scrollPane.setBounds(50, 30, 300, 50); | |
TreeViewer viewr = new TreeViewer(Arrays.asList( | |
parser.getRuleNames()),tree); | |
viewr.setScale(1.5);//scale a little | |
panel.add(viewr); | |
frame.add(scrollPane); | |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
frame.setSize(600,400); | |
frame.setVisible(true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment