diff --git a/pom.xml b/pom.xml index 25f842b1..9de7c444 100644 --- a/pom.xml +++ b/pom.xml @@ -48,11 +48,6 @@ commons-io 1.3.2 - - org.apache.commons - commons-lang3 - 3.7 - org.apache.httpcomponents httpclient diff --git a/src/main/java/com/rarchives/ripme/ui/MainWindow.java b/src/main/java/com/rarchives/ripme/ui/MainWindow.java index f25d1320..89ff99df 100644 --- a/src/main/java/com/rarchives/ripme/ui/MainWindow.java +++ b/src/main/java/com/rarchives/ripme/ui/MainWindow.java @@ -51,7 +51,6 @@ import javax.swing.text.SimpleAttributeSet; import javax.swing.text.StyleConstants; import javax.swing.text.StyledDocument; -import org.apache.commons.lang3.ArrayUtils; import org.apache.log4j.ConsoleAppender; import org.apache.log4j.FileAppender; import org.apache.log4j.Level; @@ -153,8 +152,12 @@ public final class MainWindow implements Runnable, RipStatusHandler { } private static int getAverageFontWidth(JComponent component) { + int sum = 0; int[] widths = component.getFontMetrics(component.getFont()).getWidths(); - return Collections.max(Arrays.asList(ArrayUtils.toObject(widths))); + for(int i : widths) { + sum += i; + } + return sum / widths.length; } private static void insertWrappedString(JComponent parent, StyledDocument document, String string, SimpleAttributeSet s) @@ -165,7 +168,7 @@ public final class MainWindow implements Runnable, RipStatusHandler { while(i < string.length()/maxCharsToFit) { if(i > 0) resultString.append(string.substring(i*maxCharsToFit-2, i*maxCharsToFit)); resultString.append(string.substring(i*maxCharsToFit, (i+1)*maxCharsToFit-2)); - resultString.append("\\\n"); + resultString.append("\n"); i++; } resultString.append(string.substring(string.length()-(string.length()%maxCharsToFit))); @@ -383,7 +386,6 @@ public final class MainWindow implements Runnable, RipStatusHandler { logPanel.setBorder(emptyBorder); logText = new JTextPane(); logText.setEditable(false); - logText.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12)); JScrollPane logTextScroll = new JScrollPane(logText); logTextScroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); logPanel.setVisible(false);