Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

38
LINES

< > BotCompany Repo | #1011951 // lanternaShow - show Lanterna GUI with a window

JavaX fragment (include)

lib 1004408

import com.googlecode.lanterna.TerminalSize;
import com.googlecode.lanterna.TextColor;
import com.googlecode.lanterna.gui2.Window;
import com.googlecode.lanterna.gui2.LayoutManager;
import com.googlecode.lanterna.gui2.Component;
import com.googlecode.lanterna.gui2.*;
import com.googlecode.lanterna.gui2.Panel;
import com.googlecode.lanterna.gui2.Label;
import com.googlecode.lanterna.gui2.GridLayout;
import com.googlecode.lanterna.gui2.Button;
import com.googlecode.lanterna.screen.Screen;
import com.googlecode.lanterna.screen.TerminalScreen;
import com.googlecode.lanterna.terminal.DefaultTerminalFactory;
import com.googlecode.lanterna.terminal.Terminal;

static void lanternaShow(Panel panel) ctex {
  lanternaShow("", panel);
}

static void lanternaShow(S title, Panel panel) ctex {
  BasicWindow window = new BasicWindow(unnull(title));
  window.setCloseWindowWithEscape(true);
  window.setComponent(panel);
  lanternaShow(window);
}

static void lanternaShow(Window window) ctex {
  // Setup terminal and screen layers
  Terminal terminal = new DefaultTerminalFactory().createTerminal();
  Screen screen = new TerminalScreen(terminal);
  screen.startScreen();
  
  // Create gui and start gui
  MultiWindowTextGUI gui = new MultiWindowTextGUI(screen, new DefaultWindowManager(), new EmptySpace(TextColor.ANSI.BLUE));
  gui.addWindowAndWait(window);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1011951
Snippet name: lanternaShow - show Lanterna GUI with a window
Eternal ID of this version: #1011951/11
Text MD5: 115d37f4f46adf5ed0630ec74520cc32
Author: stefan
Category: javax / lanterna
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-12 03:46:17
Source code size: 1409 bytes / 38 lines
Pitched / IR pitched: No / No
Views / Downloads: 348 / 383
Version history: 10 change(s)
Referenced in: [show references]