!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+) - (.*?)
").matcher(page);
new DefaultListModel model;
while (m.find())
model.addElement(htmldecode(m.group(1) + " - " + m.group(2)));
list.setModel(model);
}
}