Package jexer.backend
Class SwingBackend
- java.lang.Object
-
- jexer.backend.GenericBackend
-
- jexer.backend.SwingBackend
-
- All Implemented Interfaces:
Backend
public class SwingBackend extends GenericBackend
This class uses standard Swing calls to handle screen, keyboard, and mouse I/O.
-
-
Field Summary
-
Fields inherited from class jexer.backend.GenericBackend
lastUserInputTime, readOnly, screen, sessionInfo, terminal
-
-
Constructor Summary
Constructors Constructor Description SwingBackend()
Public constructor.SwingBackend(int windowWidth, int windowHeight)
Public constructor will spawn a new JFrame with font size 20 pts.SwingBackend(int windowWidth, int windowHeight, int fontSize)
Public constructor will spawn a new JFrame.SwingBackend(java.lang.Object listener)
Public constructor.SwingBackend(java.lang.Object listener, int windowWidth, int windowHeight, int fontSize)
Public constructor will spawn a new JFrame.SwingBackend(javax.swing.JComponent component, java.lang.Object listener, int windowWidth, int windowHeight, int fontSize)
Public constructor will render onto a JComponent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getBlinkMillis()
Get the number of millis to wait before switching the blink from visible to invisible.SwingComponent
getSwingComponent()
Getter for the underlying Swing component.void
setFont(java.awt.Font font)
Set to a new font, and resize the screen to match its dimensions.-
Methods inherited from class jexer.backend.GenericBackend
flushScreen, getEvents, getScreen, getSessionInfo, hasEvents, isReadOnly, reloadOptions, setListener, setReadOnly, setTitle, shutdown
-
-
-
-
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 withwindowHeight
- 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 withwindowHeight
- the number of text rows to start withfontSize
- 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 inwindowWidth
- the number of text columns to start withwindowHeight
- the number of text rows to start withfontSize
- 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 tolistener
- the object this backend needs to wake up when new input comes inwindowWidth
- the number of text columns to start withwindowHeight
- the number of text rows to start withfontSize
- 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
-
-