X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fbackend%2FMultiScreen.java;h=9d66b69342896a50c6d8683d6cc4c463db4491c2;hb=9892fdaafb368227aa9630ab3abe6ed10bb1d001;hp=880ee1888300d12ae936ed2106c927b311cdc5a0;hpb=9696a8f6da9a0d204740420d6d8571176ab81944;p=fanfix.git diff --git a/src/jexer/backend/MultiScreen.java b/src/jexer/backend/MultiScreen.java index 880ee18..9d66b69 100644 --- a/src/jexer/backend/MultiScreen.java +++ b/src/jexer/backend/MultiScreen.java @@ -28,7 +28,7 @@ */ package jexer.backend; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.List; import jexer.bits.Cell; @@ -46,7 +46,7 @@ public class MultiScreen implements Screen { /** * The list of screens to use. */ - private List screens = new LinkedList(); + private List screens = new ArrayList(); // ------------------------------------------------------------------------ // Constructors ----------------------------------------------------------- @@ -241,7 +241,7 @@ public class MultiScreen implements Screen { * @param ch character to draw * @param attr attributes to use (bold, foreColor, backColor) */ - public void putAll(final char ch, final CellAttributes attr) { + public void putAll(final int ch, final CellAttributes attr) { for (Screen screen: screens) { screen.putAll(ch, attr); } @@ -268,7 +268,7 @@ public class MultiScreen implements Screen { * @param ch character to draw * @param attr attributes to use (bold, foreColor, backColor) */ - public void putCharXY(final int x, final int y, final char ch, + public void putCharXY(final int x, final int y, final int ch, final CellAttributes attr) { for (Screen screen: screens) { @@ -283,7 +283,7 @@ public class MultiScreen implements Screen { * @param y row coordinate. 0 is the top-most row. * @param ch character to draw */ - public void putCharXY(final int x, final int y, final char ch) { + public void putCharXY(final int x, final int y, final int ch) { for (Screen screen: screens) { screen.putCharXY(x, y, ch); } @@ -329,7 +329,7 @@ public class MultiScreen implements Screen { * @param attr attributes to use (bold, foreColor, backColor) */ public void vLineXY(final int x, final int y, final int n, - final char ch, final CellAttributes attr) { + final int ch, final CellAttributes attr) { for (Screen screen: screens) { screen.vLineXY(x, y, n, ch, attr); @@ -346,7 +346,7 @@ public class MultiScreen implements Screen { * @param attr attributes to use (bold, foreColor, backColor) */ public void hLineXY(final int x, final int y, final int n, - final char ch, final CellAttributes attr) { + final int ch, final CellAttributes attr) { for (Screen screen: screens) { screen.hLineXY(x, y, n, ch, attr); @@ -646,14 +646,7 @@ public class MultiScreen implements Screen { public int getTextWidth() { int textWidth = 16; for (Screen screen: screens) { - int newTextWidth = textWidth; - if (screen instanceof MultiScreen) { - newTextWidth = ((MultiScreen) screen).getTextWidth(); - } else if (screen instanceof ECMA48Terminal) { - newTextWidth = ((ECMA48Terminal) screen).getTextWidth(); - } else if (screen instanceof SwingTerminal) { - newTextWidth = ((SwingTerminal) screen).getTextWidth(); - } + int newTextWidth = screen.getTextWidth(); if (newTextWidth < textWidth) { textWidth = newTextWidth; } @@ -669,14 +662,7 @@ public class MultiScreen implements Screen { public int getTextHeight() { int textHeight = 20; for (Screen screen: screens) { - int newTextHeight = textHeight; - if (screen instanceof MultiScreen) { - newTextHeight = ((MultiScreen) screen).getTextHeight(); - } else if (screen instanceof ECMA48Terminal) { - newTextHeight = ((ECMA48Terminal) screen).getTextHeight(); - } else if (screen instanceof SwingTerminal) { - newTextHeight = ((SwingTerminal) screen).getTextHeight(); - } + int newTextHeight = screen.getTextHeight(); if (newTextHeight < textHeight) { textHeight = newTextHeight; }