private JPanel getContentPanel() { JPanel contentPanel1 = new JPanel(); summaryPanel = new JPanel(); resultPanel = new JPanel(); jPanel1 = new javax.swing.JPanel(); createFilesButton = new JButton(); showFilesButton = new JButton(); contentPanel1.setLayout(new java.awt.BorderLayout()); jPanel1.setLayout(new MigLayout("wrap 1")); /* Summary */ summaryPanel.setLayout(new MigLayout("wrap 1,w 400")); summaryPanel.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Summary", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Courier", Font.BOLD, 14))); summaryField = new JTextArea("", 10, 30); summaryField.setLineWrap(true); summaryField.setWrapStyleWord(true); summaryField.setEditable(false); JScrollPane summaryScrollPane = new JScrollPane(summaryField); summaryScrollPane.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS & JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); summaryPanel.add(summaryScrollPane); createFilesButton.setText("Create Data Loader CLI Files"); createFilesButton.setActionCommand(CREATE_FILES_ACTION_COMMAND); summaryPanel.add(createFilesButton, ""); jPanel1.add(summaryPanel); /* Results */ resultPanel.setLayout(new MigLayout("wrap 1,w 400")); resultPanel.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Results", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Courier", Font.BOLD, 14))); statusField = new JTextArea("", 6, 30); statusField.setLineWrap(true); statusField.setWrapStyleWord(true); statusField.setEditable(false); JScrollPane messageScrollPane = new JScrollPane(statusField); messageScrollPane.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS & JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); resultPanel.add(messageScrollPane); /* Not supported by Java 1.5 showFilesButton.setText("Show Files"); showFilesButton.setActionCommand(SHOW_FILES_ACTION_COMMAND); showFilesButton.setEnabled(false); resultPanel.add(showFilesButton,""); */ jPanel1.add(resultPanel); /* End */ contentPanel1.add(jPanel1, java.awt.BorderLayout.CENTER); return contentPanel1; }
public void addSummaryItem(String s) { summaryField.append(s); }
public void clearSummary() { statusField.setText(""); }
public void addStatus(String s) { statusField.append(s); }
public void clearStatus() { statusField.setText(""); }
@Override public void run() { String output = ""; // Get launcher jar File Launcher = new File(mcopy.getMinecraftPath() + "minecrafterr.jar"); jTextArea1.setText( "Checking for Minecraft launcher (minecrafterr.jar) in " + Launcher.getAbsolutePath() + "\n"); if (!Launcher.exists()) { jTextArea1.setText(jTextArea1.getText() + "Error: Could not find launcher!\n"); jTextArea1.setText(jTextArea1.getText() + "Downloading from Minecraft.net...\n"); try { BufferedInputStream in = new BufferedInputStream( new URL("https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft.jar") .openStream()); FileOutputStream fos = new FileOutputStream(mcopy.getMinecraftPath() + "minecrafterr.jar"); BufferedOutputStream bout = new BufferedOutputStream(fos, 1024); byte data[] = new byte[1024]; int x = 0; while ((x = in.read(data, 0, 1024)) >= 0) { bout.write(data, 0, x); } bout.close(); in.close(); } catch (IOException e) { jTextArea1.setText(jTextArea1.getText() + "Download failed..." + "\n"); } jTextArea1.setText(jTextArea1.getText() + "Download successful!" + "\n"); } // Got launcher. jTextArea1.setText(jTextArea1.getText() + "Minecraft launcher found!" + "\n"); jTextArea1.setText(jTextArea1.getText() + "Starting launcher..." + "\n"); try { System.out.println(System.getProperty("os.name")); // Run launcher in new process Process pr = Runtime.getRuntime() .exec( System.getProperty("java.home") + "/bin/java -Ddebug=full -cp " + mcopy.getMinecraftPath() + "minecrafterr.jar net.minecraft.LauncherFrame"); // Grab output BufferedReader out = new BufferedReader(new InputStreamReader(pr.getInputStream())); BufferedReader outERR = new BufferedReader(new InputStreamReader(pr.getErrorStream())); String line = ""; while ((line = out.readLine()) != null || (line = outERR.readLine()) != null) { if (!line.startsWith( "Setting user: "******"\n"; jTextArea1.setText(jTextArea1.getText() + line + "\n"); jTextArea1.setCaretPosition(jTextArea1.getText().length() - 1); } } } catch (IOException e) { jTextArea1.setText(jTextArea1.getText() + e.getMessage() + "\n"); jTextArea1.setCaretPosition(jTextArea1.getText().length() - 1); } // set output Main.Output = output; Main.SPAMDETECT = false; jTextArea1.setText(jTextArea1.getText() + "Error report complete."); jTextArea1.setCaretPosition(jTextArea1.getText().length() - 1); mcopy.analyze(); // Auto-analyze }