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

50
LINES

< > BotCompany Repo | #1000274 // JavaX IDE (v2 - does something!)

JavaX source code - run with: x30.jar

!592 // auto-import
!614 // actionListener {
!1000271 // standard classes (LetterLayout, CenteredLine)
!1000272 // class x9

import java.awt.*;

public class main {
  public static void main(String[] args) {
    JFrame frame = new JFrame("JavaX IDE!");
    
    final JTextArea textArea = new JTextArea();
    JButton btnGo = new JButton("Go!");
    btnGo.addActionListener(actionListener {
      try {
        File ioBaseDir = new File(".");
        File src = x9.TempDirMaker_make();
        x9.saveTextFile(new File(src, "main.java").getPath(), textArea.getText());
        x9.javax4(src.getPath(), ioBaseDir, false, false);
      } catch (Throwable e) {
        popupError(e);
      }
    });

    JPanel panel = new JPanel(new LetterLayout("T", "T", "B").setBorder(10));
    panel.add("T", new JScrollPane(textArea));
    panel.add("B", new CenteredLine(btnGo));
    frame.add(panel);
    
    frame.setBounds(100, 100, 500, 400);
    frame.setVisible(true);
    exitOnFrameClose(frame);
  }
  
  static void exitOnFrameClose(JFrame frame) {
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
  
  static void popupError(final Throwable throwable) {
    throwable.printStackTrace(); // print stack trace to console for the experts
    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        String text = throwable.toString();
        //text = cutPrefix(text, "java.lang.RuntimeException: ");
        JOptionPane.showMessageDialog(null, text);
      }
    });
  }

}

Author comment

Began life as a copy of #613

download  show line numbers  debug dex  old transpilations   

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

Comments [hide]

ID Author/Program Comment Date
481 #1000610 (pitcher) 2015-08-18 00:07:07
480 #1000604 (pitcher) 2015-08-18 00:07:22
59 stefan Run with "java x9 1000274" (tinybrain.de/x9.class) 2015-05-11 17:29:32

add comment

Snippet ID: #1000274
Snippet name: JavaX IDE (v2 - does something!)
Eternal ID of this version: #1000274/1
Text MD5: 4e285f39680ba7fcb68ade1cb8142a31
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-05-10 18:10:04
Source code size: 1555 bytes / 50 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 918 / 745
Referenced in: [show references]