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

53
LINES

< > BotCompany Repo | #1000794 // Runnables search (Swing)

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

Libraryless. Click here for Pure Java version (314L/4K/12K).

1  
!636
2  
!modern // includes string ==
3  
!actionListener {
4  
!x619 // standard classes (LetterLayout, CenteredLine)
5  
!multi-line strings
6  
7  
import java.awt.*;
8  
import java.awt.event.*;
9  
import java.util.List;
10  
11  
main {
12  
  static JList list;
13  
  static JTextField tfCmd;
14  
15  
  psvm {
16  
    JFrame frame = new JFrame("Runnables");
17  
    
18  
    JPanel panel = new JPanel(new BorderLayout());
19  
    
20  
    list = new JList();
21  
    panel.add(BorderLayout.CENTER, new JScrollPane(list));
22  
    
23  
    tfCmd = new JTextField();
24  
    panel.add(BorderLayout.NORTH, tfCmd);
25  
    
26  
    tfCmd.addActionListener(actionListener {
27  
      tfCmd.selectAll();
28  
      String cmd = tfCmd.getText();
29  
      runCmd(cmd);
30  
    });
31  
    
32  
    frame.addWindowListener(new WindowAdapter() {
33  
      public void windowOpened(WindowEvent e) {
34  
        tfCmd.requestFocus();
35  
      }
36  
    }); 
37  
    
38  
    frame.add(panel);
39  
    frame.setBounds(100, 100, 500, 400);
40  
    frame.setVisible(true);
41  
    exitOnFrameClose(frame);
42  
  }
43  
  
44  
  static void runCmd(String cmd) ctex {
45  
    S page = loadPage("http://tinybrain.de:8080/tb/search.php?q=" + urlencode(cmd + " type:runnable"));
46  
    Matcher m = Pattern.compile(">(#\\d+)</a> - (.*?)<br>").matcher(page);
47  
    
48  
    new DefaultListModel<S> model;
49  
    while (m.find())
50  
      model.addElement(htmldecode(m.group(1) + " - " + m.group(2)));
51  
    list.setModel(model);
52  
  }
53  
}

Author comment

Began life as a copy of #1000792

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1000794
Snippet name: Runnables search (Swing)
Eternal ID of this version: #1000794/1
Text MD5: b980ebea5337ceddcab4f664c350270b
Transpilation MD5: 6326c5895a1966d62dcde364d408dc63
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-08-28 12:36:28
Source code size: 1379 bytes / 53 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 734 / 711
Referenced in: [show references]