Package jexer.backend

Class SwingBackend

  • All Implemented Interfaces:
    Backend

    public class SwingBackend
    extends GenericBackend
    This class uses standard Swing calls to handle screen, keyboard, and mouse I/O.
    • Constructor Detail

      • SwingBackend

        public SwingBackend()
        Public constructor. The window will be 80x25 with font size 20 pts.
      • SwingBackend

        public SwingBackend​(java.lang.Object listener)
        Public constructor. The window will be 80x25 with font size 20 pts.
        Parameters:
        listener - the object this backend needs to wake up when new input comes in
      • SwingBackend

        public SwingBackend​(int windowWidth,
                            int windowHeight)
        Public constructor will spawn a new JFrame with font size 20 pts.
        Parameters:
        windowWidth - the number of text columns to start with
        windowHeight - the number of text rows to start with
      • SwingBackend

        public SwingBackend​(int windowWidth,
                            int windowHeight,
                            int fontSize)
        Public constructor will spawn a new JFrame.
        Parameters:
        windowWidth - the number of text columns to start with
        windowHeight - the number of text rows to start with
        fontSize - the size in points. Good values to pick are: 16, 20, 22, and 24.
      • SwingBackend

        public SwingBackend​(java.lang.Object listener,
                            int windowWidth,
                            int windowHeight,
                            int fontSize)
        Public constructor will spawn a new JFrame.
        Parameters:
        listener - the object this backend needs to wake up when new input comes in
        windowWidth - the number of text columns to start with
        windowHeight - the number of text rows to start with
        fontSize - the size in points. Good values to pick are: 16, 20, 22, and 24.
      • SwingBackend

        public SwingBackend​(javax.swing.JComponent component,
                            java.lang.Object listener,
                            int windowWidth,
                            int windowHeight,
                            int fontSize)
        Public constructor will render onto a JComponent.
        Parameters:
        component - the Swing component to render to
        listener - the object this backend needs to wake up when new input comes in
        windowWidth - the number of text columns to start with
        windowHeight - the number of text rows to start with
        fontSize - the size in points. Good values to pick are: 16, 20, 22, and 24.
    • Method Detail

      • setFont

        public void setFont​(java.awt.Font font)
        Set to a new font, and resize the screen to match its dimensions.
        Parameters:
        font - the new font
      • getBlinkMillis

        public long getBlinkMillis()
        Get the number of millis to wait before switching the blink from visible to invisible.
        Returns:
        the number of milli to wait before switching the blink from visible to invisible
      • getSwingComponent

        public SwingComponent getSwingComponent()
        Getter for the underlying Swing component.
        Returns:
        the SwingComponent