Refactor + a few improvements to UI #8
|
@ -4,6 +4,7 @@ import dev.frogmc.frogloader.impl.gui.component.DependencyErrorEntry;
|
||||||
import dev.frogmc.frogloader.impl.mod.ModDependencyResolver;
|
import dev.frogmc.frogloader.impl.mod.ModDependencyResolver;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class BreakingDepPage extends JScrollPane {
|
public class BreakingDepPage extends JScrollPane {
|
||||||
|
@ -47,6 +48,7 @@ public class BreakingDepPage extends JScrollPane {
|
||||||
list.add(result);
|
list.add(result);
|
||||||
});
|
});
|
||||||
setViewportView(list);
|
setViewportView(list);
|
||||||
|
SwingUtilities.invokeLater(() -> getViewport().setViewPosition(new Point()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package dev.frogmc.frogloader.impl.gui.page;
|
package dev.frogmc.frogloader.impl.gui.page;
|
||||||
|
|
||||||
import dev.frogmc.frogloader.impl.util.PlatformUtil;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
|
@ -10,18 +9,24 @@ import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
|
||||||
public class ReportPage extends JTextPane {
|
public class ReportPage extends JScrollPane {
|
||||||
|
|
||||||
public ReportPage(Path reportPath) {
|
public ReportPage(Path reportPath) {
|
||||||
setEditable(false);
|
getHorizontalScrollBar().setUnitIncrement(16);
|
||||||
|
getVerticalScrollBar().setUnitIncrement(16);
|
||||||
|
|
||||||
|
JTextPane text = new JTextPane();
|
||||||
|
text.setEditable(false);
|
||||||
try {
|
try {
|
||||||
setText(Files.readString(reportPath, StandardCharsets.UTF_8));
|
text.setText(Files.readString(reportPath, StandardCharsets.UTF_8));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
StringWriter writer = new StringWriter();
|
StringWriter writer = new StringWriter();
|
||||||
PrintWriter printer = new PrintWriter(writer);
|
PrintWriter printer = new PrintWriter(writer);
|
||||||
printer.printf("Could not load contents of %s:%n", reportPath);
|
printer.printf("Could not load contents of %s:%n", reportPath);
|
||||||
e.printStackTrace(printer);
|
e.printStackTrace(printer);
|
||||||
}
|
}
|
||||||
|
setViewportView(text);
|
||||||
|
SwingUtilities.invokeLater(() -> getViewport().setViewPosition(new Point(0, 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
package dev.frogmc.frogloader.impl.gui.page;
|
package dev.frogmc.frogloader.impl.gui.page;
|
||||||
|
|
||||||
import dev.frogmc.frogloader.impl.FrogLoaderImpl;
|
|
||||||
import dev.frogmc.frogloader.impl.gui.component.DependencyErrorEntry;
|
import dev.frogmc.frogloader.impl.gui.component.DependencyErrorEntry;
|
||||||
import dev.frogmc.frogloader.impl.mod.ModDependencyResolver;
|
import dev.frogmc.frogloader.impl.mod.ModDependencyResolver;
|
||||||
import dev.frogmc.frogloader.impl.mod.ModUtil;
|
|
||||||
import dev.frogmc.frogloader.impl.util.PlatformUtil;
|
import dev.frogmc.frogloader.impl.util.PlatformUtil;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
@ -73,6 +72,7 @@ public class UnfulfilledDepPage extends JScrollPane {
|
||||||
});
|
});
|
||||||
|
|
||||||
setViewportView(list);
|
setViewportView(list);
|
||||||
|
SwingUtilities.invokeLater(() -> getViewport().setViewPosition(new Point()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ public class AccessWidener {
|
||||||
public record Entry(AccessType type, String targetType, String className, String name, String descriptor) {
|
public record Entry(AccessType type, String targetType, String className, String name, String descriptor) {
|
||||||
|
|
||||||
public Entry(String[] line) {
|
public Entry(String[] line) {
|
||||||
this(AccessType.of(line[0]), line[1], line[2], line[3], line[4]);
|
this(AccessType.of(line[0]), line[1], line[2], line.length > 3 ? line[3] : null, line.length > 4 ? line[4] : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAccessGreaterThan(Entry other) {
|
public boolean isAccessGreaterThan(Entry other) {
|
||||||
|
|
Loading…
Reference in a new issue