X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fdemos%2FDemo6.java;h=db0b5c9d3f53a7083d4a47a99930ebcec9058d3b;hb=edcd53bbbba9f94e21f43fd03d3a2febcc2b1564;hp=236e7a276733410d95d80224be04ccb792adc889;hpb=a69ed767c9c07cf35cf1c5f7821fc009cfe79cd2;p=nikiroo-utils.git diff --git a/src/jexer/demos/Demo6.java b/src/jexer/demos/Demo6.java deleted file mode 100644 index 236e7a2..0000000 --- a/src/jexer/demos/Demo6.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Jexer - Java Text User Interface - * - * The MIT License (MIT) - * - * 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"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * @author Kevin Lamonte [kevin.lamonte@gmail.com] - * @version 1 - */ -package jexer.demos; - -import jexer.TApplication; -import jexer.backend.*; -import jexer.demos.DemoApplication; - -/** - * This class shows off the use of MultiBackend and MultiScreen. - */ -public class Demo6 { - - /** - * Main entry point. - * - * @param args Command line arguments - */ - public static void main(final String [] args) { - try { - - /* - * In this demo we will create two applications spanning three - * screens. One of the applications will have both an ECMA48 - * screen and a Swing screen, with all I/O mirrored between them. - * The second application will have a Swing screen containing a - * window showing the first application, also mirroring I/O - * between the window and the other two screens. - */ - - /* - * We create the first screen and use it to establish a - * MultiBackend. - */ - ECMA48Backend ecmaBackend = new ECMA48Backend(); - MultiBackend multiBackend = new MultiBackend(ecmaBackend); - - /* - * Now we create the first application (a standard demo). - */ - DemoApplication demoApp = new DemoApplication(multiBackend); - - /* - * We will need the width and height of the ECMA48 screen, so get - * the Screen reference now. - */ - Screen multiScreen = multiBackend.getScreen(); - - /* - * Now we create the second screen (backend) for the first - * application. It will be the same size as the ECMA48 screen, - * with a font size of 16 points. - */ - SwingBackend swingBackend = new SwingBackend(multiScreen.getWidth(), - multiScreen.getHeight(), 16); - - /* - * Add this screen to the MultiBackend, and at this point we have - * one demo application spanning two physical screens. - */ - multiBackend.addBackend(swingBackend); - multiBackend.setListener(demoApp); - - /* - * Time for the second application. This one will have a single - * window mirroring the contents of the first application. Let's - * make it a little larger than the first application's - * width/height. - */ - int width = multiScreen.getWidth(); - int height = multiScreen.getHeight(); - - /* - * Make a new Swing window for the second application. - */ - SwingBackend monitorBackend = new SwingBackend(width + 5, - height + 5, 16); - - /* - * Setup the second application, give it the basic file and - * window menus. - */ - TApplication monitor = new TApplication(monitorBackend); - monitor.addFileMenu(); - monitor.addWindowMenu(); - - /* - * Now add the third screen to the first application. We want to - * change the object it locks on in its draw() method to the - * MultiScreen, that will dramatically reduce (not totally - * eliminate) screen tearing/artifacts. - */ - TWindowBackend windowBackend = new TWindowBackend(demoApp, - monitor, "Monitor Window", width + 2, height + 2); - windowBackend.setDrawLock(multiScreen); - multiBackend.addBackend(windowBackend); - - /* - * Three screens, two applications: spin them up! - */ - (new Thread(demoApp)).start(); - (new Thread(monitor)).start(); - } catch (Exception e) { - e.printStackTrace(); - } - } - -}