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

43
LINES

< > BotCompany Repo | #1004410 // Lanterna Test [Text Mode UI, WORKS]

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Uses 507K of libraries. Click here for Pure Java version (904L/7K/23K).

1  
!752
2  
3  
lib 1004408
4  
5  
import com.googlecode.lanterna.TerminalSize;
6  
import com.googlecode.lanterna.TextColor;
7  
import com.googlecode.lanterna.gui2.*;
8  
import com.googlecode.lanterna.gui2.Panel;
9  
import com.googlecode.lanterna.gui2.Label;
10  
import com.googlecode.lanterna.gui2.GridLayout;
11  
import com.googlecode.lanterna.gui2.Button;
12  
import com.googlecode.lanterna.screen.Screen;
13  
import com.googlecode.lanterna.screen.TerminalScreen;
14  
import com.googlecode.lanterna.terminal.DefaultTerminalFactory;
15  
import com.googlecode.lanterna.terminal.Terminal;
16  
17  
p {
18  
  // Create panel to hold components
19  
  Panel panel = new Panel();
20  
  panel.setLayoutManager(new GridLayout(2));
21  
22  
  panel.addComponent(new Label("Forename"));
23  
  panel.addComponent(new TextBox());
24  
25  
  panel.addComponent(new Label("Surname"));
26  
  panel.addComponent(new TextBox());
27  
28  
  panel.addComponent(new EmptySpace(new TerminalSize(0,0))); // Empty space underneath labels
29  
  panel.addComponent(new Button("Submit"));
30  
31  
  // Create window to hold the panel
32  
  BasicWindow window = new BasicWindow();
33  
  window.setComponent(panel);
34  
35  
  // Setup terminal and screen layers
36  
  Terminal terminal = new DefaultTerminalFactory().createTerminal();
37  
  Screen screen = new TerminalScreen(terminal);
38  
  screen.startScreen();
39  
  
40  
  // Create gui and start gui
41  
  MultiWindowTextGUI gui = new MultiWindowTextGUI(screen, new DefaultWindowManager(), new EmptySpace(TextColor.ANSI.BLUE));
42  
  gui.addWindowAndWait(window);
43  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1004410
Snippet name: Lanterna Test [Text Mode UI, WORKS]
Eternal ID of this version: #1004410/2
Text MD5: 9904179c461d731322eee35f09c88974
Transpilation MD5: 5cce811d65310b47fe3d886d0a3b1c4d
Author: stefan
Category:
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-12 03:31:43
Source code size: 1481 bytes / 43 lines
Pitched / IR pitched: No / No
Views / Downloads: 626 / 636
Version history: 1 change(s)
Referenced in: [show references]