Module Simula

Class RTS_ConsolePanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public final class RTS_ConsolePanel extends JPanel
This is an implementation of a Console Panel.

Link to GitHub: Source File.

Author:
Øystein Myhre Andersen
See Also:
  • Field Details

    • textPane

      private static JTextPane textPane
      The text pane.
    • doc

      private StyledDocument doc
      the StyledDocument showed in this panel
    • styleRegular

      private Style styleRegular
      Regular style
    • styleWarning

      private Style styleWarning
      Warning style
    • styleError

      private Style styleError
      Error style
    • popupMenu

      private JPopupMenu popupMenu
      the Popup Menu
    • clearItem

      private JMenuItem clearItem
      Menu item clear
    • copyItem

      private JMenuItem copyItem
      Menu item copy
    • reading

      private boolean reading
      Used by KeyListener and read()
    • keyin

      private char keyin
      Used by KeyListener and read()
    • consoleReader

      private Reader consoleReader
      the Reader to read input from the console
    • mouseListener

      MouseListener mouseListener
      the MouseListener
    • actionListener

      ActionListener actionListener
      the ActionListener
    • listener

      private KeyListener listener
      the KeyListener
  • Constructor Details

    • RTS_ConsolePanel

      public RTS_ConsolePanel()
      Create a new _RTConsolePanel
  • Method Details

    • read

      public char read()
      Reads a single character.
      Returns:
      The character read
    • getReader

      public Reader getReader()
      Get a reader suitable for reading from this panel
      Returns:
      a reader
    • getOutputStream

      public OutputStream getOutputStream()
      Get a OutputStream suitable for writing on this panel
      Returns:
      a OutputStream
    • getWriter

      public Writer getWriter()
      Get a writer suitable for writing on this panel
      Returns:
      a writer
    • getErrorStream

      public OutputStream getErrorStream()
      Get a OutputStream suitable for writing errors on this panel
      Returns:
      a OutputStream
    • write

      public void write(String s)
      Write a string on this panel using styleRegular.
      Parameters:
      s - a string to write
    • writeError

      public void writeError(String s)
      Write a string on this panel using styleError.
      Parameters:
      s - a string to write
    • writeWarning

      public void writeWarning(String s)
      Write a string on this panel using styleWarning.
      Parameters:
      s - a string to write
    • write

      private void write(String s, Style style)
      Write a styled string onto the console
      Parameters:
      s - the string to write
      style - the Style
    • clear

      public void clear()
      Clear the panel. I.e. remove all content from the panel.
    • IERR

      public static void IERR(String msg, Throwable e)
      Print an INTERNAL ERROR and StackTrace
      Parameters:
      msg - the error message
      e - an Throwable
    • popup

      public void popup(String title)
      popup this Console Panel
      Parameters:
      title - for the Panel
    • addStylesToDocument

      private void addStylesToDocument(StyledDocument doc)
      Add styles to a Document
      Parameters:
      doc - the Document