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)

1  
lib 1004408
2  
3  
import com.googlecode.lanterna.TerminalSize;
4  
import com.googlecode.lanterna.TextColor;
5  
import com.googlecode.lanterna.gui2.Window;
6  
import com.googlecode.lanterna.gui2.LayoutManager;
7  
import com.googlecode.lanterna.gui2.Component;
8  
import com.googlecode.lanterna.gui2.*;
9  
import com.googlecode.lanterna.gui2.Panel;
10  
import com.googlecode.lanterna.gui2.Label;
11  
import com.googlecode.lanterna.gui2.GridLayout;
12  
import com.googlecode.lanterna.gui2.Button;
13  
import com.googlecode.lanterna.screen.Screen;
14  
import com.googlecode.lanterna.screen.TerminalScreen;
15  
import com.googlecode.lanterna.terminal.DefaultTerminalFactory;
16  
import com.googlecode.lanterna.terminal.Terminal;
17  
18  
static void lanternaShow(Panel panel) ctex {
19  
  lanternaShow("", panel);
20  
}
21  
22  
static void lanternaShow(S title, Panel panel) ctex {
23  
  BasicWindow window = new BasicWindow(unnull(title));
24  
  window.setCloseWindowWithEscape(true);
25  
  window.setComponent(panel);
26  
  lanternaShow(window);
27  
}
28  
29  
static void lanternaShow(Window window) ctex {
30  
  // Setup terminal and screen layers
31  
  Terminal terminal = new DefaultTerminalFactory().createTerminal();
32  
  Screen screen = new TerminalScreen(terminal);
33  
  screen.startScreen();
34  
  
35  
  // Create gui and start gui
36  
  MultiWindowTextGUI gui = new MultiWindowTextGUI(screen, new DefaultWindowManager(), new EmptySpace(TextColor.ANSI.BLUE));
37  
  gui.addWindowAndWait(window);
38  
}

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: 349 / 384
Version history: 10 change(s)
Referenced in: [show references]