PMD code sweep, #6 don't add MyWindow twice to MyApplication
[fanfix.git] / src / jexer / backend / SwingBackend.java
index fc77968154e2802dac6aea4edbc09af6bb3c38c9..d6e07422d467f0cbe867ed5f755b38ac3357e4ad 100644 (file)
@@ -37,6 +37,17 @@ import javax.swing.JComponent;
  */
 public final 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.
      *
@@ -47,6 +58,30 @@ public final class SwingBackend extends GenericBackend {
         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.
      *
@@ -96,6 +131,10 @@ public final class SwingBackend extends GenericBackend {
         screen = (SwingTerminal) terminal;
     }
 
+    // ------------------------------------------------------------------------
+    // SwingBackend -----------------------------------------------------------
+    // ------------------------------------------------------------------------
+
     /**
      * Set to a new font, and resize the screen to match its dimensions.
      *
@@ -105,4 +144,15 @@ public final class SwingBackend extends GenericBackend {
         ((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();
+    }
+
 }