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

35
LINES

< > BotCompany Repo | #1000881 // Swing: Show text snippet

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

Libraryless. Click here for Pure Java version (2594L/18K/58K).

1  
!752
2  
3  
static JTextArea textArea;
4  
static JLabel status;
5  
static S snippetID = "#636";
6  
7  
public static void main(final String[] args) {
8  
 awt {
9  
  if (args.length != 0) snippetID = args[0];
10  
  
11  
  JFrame frame = new JFrame(formatSnippetID(snippetID) + " - Showing Snippet");
12  
  JPanel panel = new JPanel(new BorderLayout());
13  
  
14  
  textArea = newTypeWriterTextArea();
15  
  textArea.setEditable(false);
16  
  panel.add(BorderLayout.CENTER, new JScrollPane(textArea));
17  
  
18  
  status = new JLabel("Loading...");
19  
  panel.add(BorderLayout.SOUTH, status);
20  
  
21  
  thread {
22  
    final S s = loadSnippet(snippetID);
23  
    awt {
24  
      status.setText("Loaded " + s.length() + " chars.");
25  
      textArea.setText(s);
26  
      //textArea.scrollRectToVisible(new Rectangle(0, 0, 1, 1));
27  
      textArea.setCaretPosition(0);
28  
    }
29  
  }
30  
  
31  
  frame.add(panel);
32  
  frame.setBounds(100, 100, 500, 400);
33  
  frame.setVisible(true);
34  
 }
35  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 19 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, dhtvkmknsjym, gwrvuhgaqvyk, ishqpsrjomds, liwcxgsjrgqn, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1000881
Snippet name: Swing: Show text snippet
Eternal ID of this version: #1000881/1
Text MD5: f1eea812fb502004cedf2d5add551aca
Transpilation MD5: 551a51d1e251e231e9aaf92f287b2dc1
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-11-15 03:48:36
Source code size: 918 bytes / 35 lines
Pitched / IR pitched: No / No
Views / Downloads: 716 / 984
Referenced in: [show references]