X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fbackend%2FSwingBackend.java;h=fc77968154e2802dac6aea4edbc09af6bb3c38c9;hb=88a99379dca67603ee80819cb31716e52aa72362;hp=876015e4d125874591dcf5da5bc32cfd694dd207;hpb=42873e30bf487bc0b695d60652dba44f82185dbb;p=nikiroo-utils.git diff --git a/src/jexer/backend/SwingBackend.java b/src/jexer/backend/SwingBackend.java index 876015e..fc77968 100644 --- a/src/jexer/backend/SwingBackend.java +++ b/src/jexer/backend/SwingBackend.java @@ -28,22 +28,15 @@ */ package jexer.backend; -import java.util.List; +import java.awt.Font; import javax.swing.JComponent; -import jexer.event.TInputEvent; - /** * This class uses standard Swing calls to handle screen, keyboard, and mouse * I/O. */ public final class SwingBackend extends GenericBackend { - /** - * Input events are processed by this Terminal. - */ - private SwingTerminal terminal; - /** * Public constructor. The window will be 80x25 with font size 20 pts. * @@ -72,10 +65,10 @@ public final class SwingBackend extends GenericBackend { listener); // Hang onto the session info - this.sessionInfo = terminal.getSessionInfo(); + this.sessionInfo = ((SwingTerminal) terminal).getSessionInfo(); // SwingTerminal is the screen too - screen = terminal; + screen = (SwingTerminal) terminal; } /** @@ -97,58 +90,19 @@ public final class SwingBackend extends GenericBackend { fontSize, listener); // Hang onto the session info - this.sessionInfo = terminal.getSessionInfo(); + this.sessionInfo = ((SwingTerminal) terminal).getSessionInfo(); // SwingTerminal is the screen too - screen = terminal; - } - - /** - * Sync the logical screen to the physical device. - */ - @Override - public void flushScreen() { - screen.flushPhysical(); - } - - /** - * Get keyboard, mouse, and screen resize events. - * - * @param queue list to append new events to - */ - @Override - public void getEvents(final List queue) { - if (terminal.hasEvents()) { - terminal.getEvents(queue); - } - } - - /** - * Close the I/O, restore the console, etc. - */ - @Override - public void shutdown() { - terminal.closeTerminal(); - } - - /** - * Set the window title. - * - * @param title the new title - */ - @Override - public void setTitle(final String title) { - screen.setTitle(title); + screen = (SwingTerminal) terminal; } /** - * Set listener to a different Object. + * Set to a new font, and resize the screen to match its dimensions. * - * @param listener the new listening object that run() wakes up on new - * input + * @param font the new font */ - public void setListener(final Object listener) { - terminal.setListener(listener); + public void setFont(final Font font) { + ((SwingTerminal) terminal).setFont(font); } }