1 | !592 // auto-import
|
2 | !614 // actionListener {
|
3 | !1000271 // standard classes (LetterLayout, CenteredLine)
|
4 | !1000272 // class x9
|
5 |
|
6 | import java.awt.*;
|
7 |
|
8 | public class main {
|
9 | public static void main(String[] args) {
|
10 | JFrame frame = new JFrame("JavaX IDE!");
|
11 |
|
12 | final JTextArea textArea = new JTextArea();
|
13 | JButton btnGo = new JButton("Go!");
|
14 | btnGo.addActionListener(actionListener {
|
15 | try {
|
16 | File ioBaseDir = new File(".");
|
17 | File src = x9.TempDirMaker_make();
|
18 | x9.saveTextFile(new File(src, "main.java").getPath(), textArea.getText());
|
19 | x9.javax4(src.getPath(), ioBaseDir, false, false);
|
20 | } catch (Throwable e) {
|
21 | popupError(e);
|
22 | }
|
23 | });
|
24 |
|
25 | JPanel panel = new JPanel(new LetterLayout("T", "T", "B").setBorder(10));
|
26 | panel.add("T", new JScrollPane(textArea));
|
27 | panel.add("B", new CenteredLine(btnGo));
|
28 | frame.add(panel);
|
29 |
|
30 | frame.setBounds(100, 100, 500, 400);
|
31 | frame.setVisible(true);
|
32 | exitOnFrameClose(frame);
|
33 | }
|
34 |
|
35 | static void exitOnFrameClose(JFrame frame) {
|
36 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
37 | }
|
38 |
|
39 | static void popupError(final Throwable throwable) {
|
40 | throwable.printStackTrace(); // print stack trace to console for the experts
|
41 | SwingUtilities.invokeLater(new Runnable() {
|
42 | public void run() {
|
43 | String text = throwable.toString();
|
44 | //text = cutPrefix(text, "java.lang.RuntimeException: ");
|
45 | JOptionPane.showMessageDialog(null, text);
|
46 | }
|
47 | });
|
48 | }
|
49 |
|
50 | }
|