Fixed #38
This commit is contained in:
@@ -66,6 +66,14 @@ public class ProcessThread extends Thread {
|
||||
line = "";
|
||||
} else
|
||||
line += (char) ch;
|
||||
while ((ch = br.read()) != -1)
|
||||
if (ch == '\n') {
|
||||
printlnEvent.execute(line);
|
||||
System.out.println("Minecraft: " + line);
|
||||
p.getStdOutLines().add(line);
|
||||
line = "";
|
||||
} else
|
||||
line += (char) ch;
|
||||
stopEvent.execute(p);
|
||||
} catch (Exception e) {
|
||||
HMCLog.err("An error occured when reading process stdout/stderr.", e);
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.awt.Component;
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Window;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
@@ -279,13 +280,13 @@ public class SwingUtils {
|
||||
component.setEnabled(t);
|
||||
}
|
||||
|
||||
public static void exitIfNoWindow(Frame thisFrame) {
|
||||
public static void exitIfNoWindow(Window thisFrame) {
|
||||
exitIfNoWindow(thisFrame, false);
|
||||
}
|
||||
|
||||
public static void exitIfNoWindow(Frame thisFrame, boolean neededDispose) {
|
||||
public static void exitIfNoWindow(Window thisFrame, boolean neededDispose) {
|
||||
boolean flag = false;
|
||||
for (Frame f : Frame.getFrames()) {
|
||||
for (Window f : Window.getWindows()) {
|
||||
if (f == thisFrame)
|
||||
continue;
|
||||
if (f.isVisible())
|
||||
|
||||
@@ -17,13 +17,9 @@
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.util.ui;
|
||||
|
||||
import java.awt.Frame;
|
||||
import java.awt.HeadlessException;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.event.WindowListener;
|
||||
import java.util.List;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JDialog;
|
||||
import org.jackhuang.hellominecraft.util.StrUtils;
|
||||
import org.jackhuang.hellominecraft.util.logging.Level;
|
||||
|
||||
@@ -31,14 +27,15 @@ import org.jackhuang.hellominecraft.util.logging.Level;
|
||||
*
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class WebFrame extends JFrame {
|
||||
public class WebFrame extends JDialog {
|
||||
|
||||
public WebFrame(String... strs) {
|
||||
this(("<html>" + StrUtils.parseParams(t -> ("<font color='#" + GraphicsUtils.getColor(Level.guessLevel((String) t, Level.INFO).COLOR) + "'>"), strs, t -> "</font><br />") + "</html>")
|
||||
.replace(" ", " ").replace("\t", " "));
|
||||
}
|
||||
|
||||
public WebFrame(String content) throws HeadlessException {
|
||||
public WebFrame(String content) {
|
||||
super((JDialog) null, false);
|
||||
addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
|
||||
Reference in New Issue
Block a user