Top Description Inners Fields Constructors Methods
org.apache.groovy.antlr

public Class LexerFrame

extends JFrame
implements ActionListener
Class Inheritance
All Implemented Interfaces
java.awt.event.ActionListener, java.util.EventListener
Imports
org.antlr.v4.runtime.Token, org.apache.groovy.parser.antlr4.GroovyLangLexer, .GroovyLexer, org.codehaus.groovy.runtime.IOGroovyMethods, .ResourceGroovyMethods, javax.swing.AbstractAction, .Action, .BorderFactory, .ButtonGroup, .JButton, .JComponent, .JFileChooser, .JFrame, .JLabel, .JPanel, .JPopupMenu, .JScrollPane, .JSplitPane, .JTextArea, .JTextPane, .JToggleButton, .UIManager, .WindowConstants, javax.swing.border.Border, javax.swing.text.BadLocationException, java.awt.BorderLayout, .Dimension, .Font, .Insets, java.awt.event.ActionEvent, .ActionListener, .MouseAdapter, .MouseEvent, java.io.File, .FileReader, .Reader, .StringReader, java.lang.reflect.Field, .Modifier, java.util.HashMap, .Map

Swing application to graphically display the tokens produced by the lexer.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final JButton
private final JScrollPane
private final JScrollPane
private final JSplitPane
private final Action
private final JPanel
private static final Font
private final JTextArea
private static final long
private static final Class<GroovyLexer>
private final JTextPane
private final Map<Integer, String>
private final JLabel
Inherited from javax.swing.JFrame:
accessibleContextrootPanerootPaneCheckingEnabled

Constructor Summary

AccessConstructor and Description
public
LexerFrame()

Constructor used when invoking as a standalone application

public
LexerFrame(Reader reader)

Constructor used when invoking for a specific file

Method Summary

Modifier and TypeMethod and Description
public void
actionPerformed(ActionEvent
the event to be processed
ae
)

Implements java.awt.event.ActionListener.actionPerformed.

Invoked when an action occurs.
private Integer
eof()

private Integer
private void
private void
jbInit(Reader reader)

private void
listTokens(Class<T> tokenTypes)

public static void
main(String[] args)

private void
private void
private void
scanScript(final StringReader reader)

Inherited from javax.swing.JFrame:
addImplcreateRootPaneframeInitgetAccessibleContextgetContentPanegetDefaultCloseOperationgetGlassPanegetGraphicsgetJMenuBargetLayeredPanegetRootPanegetTransferHandlerisDefaultLookAndFeelDecoratedisRootPaneCheckingEnabledparamStringprocessWindowEventremoverepaintsetContentPanesetDefaultCloseOperationsetDefaultLookAndFeelDecoratedsetGlassPanesetIconImagesetJMenuBarsetLayeredPanesetLayoutsetRootPanesetRootPaneCheckingEnabledsetTransferHandlerupdate

Field Detail

jbuttonback to summary
private final JButton jbutton
jScrollPane1back to summary
private final JScrollPane jScrollPane1
jScrollPane2back to summary
private final JScrollPane jScrollPane2
jSplitPane1back to summary
private final JSplitPane jSplitPane1
loadFileActionback to summary
private final Action loadFileAction
mainPanelback to summary
private final JPanel mainPanel
MONOSPACED_FONTback to summary
private static final Font MONOSPACED_FONT
scriptPaneback to summary
private final JTextArea scriptPane
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.awt.Frame.serialVersionUID.

TOKEN_TYPES_CLASSback to summary
private static final Class<GroovyLexer> TOKEN_TYPES_CLASS
tokenPaneback to summary
private final JTextPane tokenPane
tokensback to summary
private final Map<Integer, String> tokens
tokenStreamLabelback to summary
private final JLabel tokenStreamLabel

Constructor Detail

LexerFrameback to summary
public LexerFrame()

Constructor used when invoking as a standalone application

LexerFrameback to summary
public LexerFrame(Reader reader)

Constructor used when invoking for a specific file

Method Detail

actionPerformedback to summary
public void actionPerformed(ActionEvent ae)

Implements java.awt.event.ActionListener.actionPerformed.

Doc from java.awt.event.ActionListener.actionPerformed.

Invoked when an action occurs.

Parameters
ae:ActionEvent

the event to be processed

eofback to summary
private Integer eof()
getColumnback to summary
private Integer getColumn(Token token)
insertComponentback to summary
private void insertComponent(JComponent comp)
jbInitback to summary
private void jbInit(Reader reader) throws Exception
listTokensback to summary
private void listTokens(Class<T> tokenTypes) throws Exception
mainback to summary
public static void main(String[] args) throws Exception
safeScanScriptback to summary
private void safeScanScript(File file)
safeScanScriptback to summary
private void safeScanScript(Reader reader)
scanScriptback to summary
private void scanScript(final StringReader reader) throws Exception
org.apache.groovy.antlr back to summary

private Class LexerFrame.HScrollableTextPane

extends JTextPane
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
getScrollableTracksViewportWidth()

Overrides javax.swing.JEditorPane.getScrollableTracksViewportWidth.

Implements javax.swing.Scrollable.getScrollableTracksViewportWidth.

Returns true if a viewport should always force the width of this Scrollable to match the width of the viewport.
public void
setSize(final Dimension
the dimension specifying the new size of this component
d
)

Overrides java.awt.Component.setSize.

Resizes this component so that it has width d.width and height d.height.
Inherited from javax.swing.JTextPane:
addStylecreateDefaultEditorKitgetCharacterAttributesgetInputAttributesgetLogicalStylegetParagraphAttributesgetStylegetStyledDocumentgetStyledEditorKitgetUIClassIDinsertComponentinsertIconparamStringremoveStylereplaceSelectionsetCharacterAttributessetDocumentsetEditorKitsetLogicalStylesetParagraphAttributessetStyledDocument

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.awt.Container.serialVersionUID.

Constructor Detail

HScrollableTextPaneback to summary
private HScrollableTextPane()

Method Detail

getScrollableTracksViewportWidthback to summary
public boolean getScrollableTracksViewportWidth()

Overrides javax.swing.JEditorPane.getScrollableTracksViewportWidth.

Implements javax.swing.Scrollable.getScrollableTracksViewportWidth.

Doc from javax.swing.JEditorPane.getScrollableTracksViewportWidth.

Returns true if a viewport should always force the width of this Scrollable to match the width of the viewport.

Returns:boolean

true if a viewport should force the Scrollables width to match its own, false otherwise

Annotations
@Override
setSizeback to summary
public void setSize(final Dimension d)

Overrides java.awt.Component.setSize.

Doc from java.awt.Component.setSize.

Resizes this component so that it has width d.width and height d.height.

This method changes layout-related information, and therefore, invalidates the component hierarchy.

Parameters
d:Dimension

the dimension specifying the new size of this component

Annotations
@Override