*
* The MIT License (MIT)
*
- * Copyright (C) 2017 Kevin Lamonte
+ * Copyright (C) 2019 Kevin Lamonte
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* This class uses standard Swing calls to handle screen, keyboard, and mouse
* I/O.
*/
-public final class SwingBackend extends GenericBackend {
+public class SwingBackend extends GenericBackend {
+
+ // ------------------------------------------------------------------------
+ // Constructors -----------------------------------------------------------
+ // ------------------------------------------------------------------------
+
+ /**
+ * Public constructor. The window will be 80x25 with font size 20 pts.
+ */
+ public SwingBackend() {
+ this(null, 80, 25, 20);
+ }
/**
* Public constructor. The window will be 80x25 with font size 20 pts.
this(listener, 80, 25, 20);
}
+ /**
+ * Public constructor will spawn a new JFrame with font size 20 pts.
+ *
+ * @param windowWidth the number of text columns to start with
+ * @param windowHeight the number of text rows to start with
+ */
+ public SwingBackend(final int windowWidth, final int windowHeight) {
+ this(null, windowWidth, windowHeight, 20);
+ }
+
+ /**
+ * Public constructor will spawn a new JFrame.
+ *
+ * @param windowWidth the number of text columns to start with
+ * @param windowHeight the number of text rows to start with
+ * @param fontSize the size in points. Good values to pick are: 16, 20,
+ * 22, and 24.
+ */
+ public SwingBackend(final int windowWidth, final int windowHeight,
+ final int fontSize) {
+
+ this(null, windowWidth, windowHeight, fontSize);
+ }
+
/**
* Public constructor will spawn a new JFrame.
*
screen = (SwingTerminal) terminal;
}
+ // ------------------------------------------------------------------------
+ // SwingBackend -----------------------------------------------------------
+ // ------------------------------------------------------------------------
+
/**
* Set to a new font, and resize the screen to match its dimensions.
*
((SwingTerminal) terminal).setFont(font);
}
+ /**
+ * Get the number of millis to wait before switching the blink from
+ * visible to invisible.
+ *
+ * @return the number of milli to wait before switching the blink from
+ * visible to invisible
+ */
+ public long getBlinkMillis() {
+ return ((SwingTerminal) terminal).getBlinkMillis();
+ }
+
+ /**
+ * Getter for the underlying Swing component.
+ *
+ * @return the SwingComponent
+ */
+ public SwingComponent getSwingComponent() {
+ return ((SwingTerminal) terminal).getSwingComponent();
+ }
+
}