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).

!752

static JTextArea textArea;
static JLabel status;
static S snippetID = "#636";

public static void main(final String[] args) {
 awt {
  if (args.length != 0) snippetID = args[0];
  
  JFrame frame = new JFrame(formatSnippetID(snippetID) + " - Showing Snippet");
  JPanel panel = new JPanel(new BorderLayout());
  
  textArea = newTypeWriterTextArea();
  textArea.setEditable(false);
  panel.add(BorderLayout.CENTER, new JScrollPane(textArea));
  
  status = new JLabel("Loading...");
  panel.add(BorderLayout.SOUTH, status);
  
  thread {
    final S s = loadSnippet(snippetID);
    awt {
      status.setText("Loaded " + s.length() + " chars.");
      textArea.setText(s);
      //textArea.scrollRectToVisible(new Rectangle(0, 0, 1, 1));
      textArea.setCaretPosition(0);
    }
  }
  
  frame.add(panel);
  frame.setBounds(100, 100, 500, 400);
  frame.setVisible(true);
 }
}

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: 715 / 981
Referenced in: [show references]