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

!636
!modern // includes string ==
!actionListener {
!x619 // standard classes (LetterLayout, CenteredLine)
!multi-line strings

import java.awt.*;
import java.awt.event.*;
import java.util.List;

main {
  static JList list;
  static JTextField tfCmd;

  psvm {
    JFrame frame = new JFrame("Runnables");
    
    JPanel panel = new JPanel(new BorderLayout());
    
    list = new JList();
    panel.add(BorderLayout.CENTER, new JScrollPane(list));
    
    tfCmd = new JTextField();
    panel.add(BorderLayout.NORTH, tfCmd);
    
    tfCmd.addActionListener(actionListener {
      tfCmd.selectAll();
      String cmd = tfCmd.getText();
      runCmd(cmd);
    });
    
    frame.addWindowListener(new WindowAdapter() {
      public void windowOpened(WindowEvent e) {
        tfCmd.requestFocus();
      }
    }); 
    
    frame.add(panel);
    frame.setBounds(100, 100, 500, 400);
    frame.setVisible(true);
    exitOnFrameClose(frame);
  }
  
  static void runCmd(String cmd) ctex {
    S page = loadPage("http://tinybrain.de:8080/tb/search.php?q=" + urlencode(cmd + " type:runnable"));
    Matcher m = Pattern.compile(">(#\\d+)</a> - (.*?)<br>").matcher(page);
    
    new DefaultListModel<S> model;
    while (m.find())
      model.addElement(htmldecode(m.group(1) + " - " + m.group(2)));
    list.setModel(model);
  }
}

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