mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-07 08:39:12 +00:00
[CLEANUP] Formatted adjusted code
This commit is contained in:
@@ -7,7 +7,7 @@ import org.parabot.core.forum.AccountManagerAccess;
|
|||||||
import org.parabot.core.io.ProgressListener;
|
import org.parabot.core.io.ProgressListener;
|
||||||
import org.parabot.core.ui.ServerSelector;
|
import org.parabot.core.ui.ServerSelector;
|
||||||
import org.parabot.core.ui.images.Images;
|
import org.parabot.core.ui.images.Images;
|
||||||
import org.parabot.core.ui.utils.Fonts;
|
import org.parabot.core.ui.fonts.Fonts;
|
||||||
import org.parabot.core.ui.utils.UILog;
|
import org.parabot.core.ui.utils.UILog;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|||||||
+6
-10
@@ -1,14 +1,10 @@
|
|||||||
package org.parabot.core.ui.utils;
|
package org.parabot.core.ui.fonts;
|
||||||
|
|
||||||
import org.parabot.core.ui.fonts.ParabotFont;
|
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Capslock
|
* @author Capslock
|
||||||
* On 28/04/16
|
|
||||||
* With IntelliJ
|
|
||||||
*/
|
*/
|
||||||
public class Fonts {
|
public class Fonts {
|
||||||
private static final java.util.List<ParabotFont> FONT_CACHE = new ArrayList<>();
|
private static final java.util.List<ParabotFont> FONT_CACHE = new ArrayList<>();
|
||||||
@@ -19,7 +15,7 @@ public class Fonts {
|
|||||||
* @param resource
|
* @param resource
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static Font getResource(final String resource){
|
public static Font getResource(final String resource) {
|
||||||
return getResource(resource, 12f);
|
return getResource(resource, 12f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,12 +23,12 @@ public class Fonts {
|
|||||||
ParabotFont parabotFont = null;
|
ParabotFont parabotFont = null;
|
||||||
|
|
||||||
for (ParabotFont font : FONT_CACHE) {
|
for (ParabotFont font : FONT_CACHE) {
|
||||||
if (font.getLocation().equalsIgnoreCase(fileName) && font.getSize() == size){
|
if (font.getLocation().equalsIgnoreCase(fileName) && font.getSize() == size) {
|
||||||
parabotFont = font;
|
parabotFont = font;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parabotFont == null){
|
if (parabotFont == null) {
|
||||||
parabotFont = new ParabotFont(fileName, size);
|
parabotFont = new ParabotFont(fileName, size);
|
||||||
FONT_CACHE.add(parabotFont);
|
FONT_CACHE.add(parabotFont);
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
package org.parabot.core.ui.fonts;
|
package org.parabot.core.ui.fonts;
|
||||||
|
|
||||||
import org.parabot.core.ui.utils.Fonts;
|
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@@ -10,12 +8,11 @@ import java.io.IOException;
|
|||||||
*/
|
*/
|
||||||
public class ParabotFont {
|
public class ParabotFont {
|
||||||
|
|
||||||
private String name;
|
|
||||||
private String location;
|
private String location;
|
||||||
private Font font;
|
private Font font;
|
||||||
|
|
||||||
public ParabotFont(String location, float size) {
|
public ParabotFont(String location, float size) {
|
||||||
if (!location.toLowerCase().startsWith("/storage/fonts/")){
|
if (!location.toLowerCase().startsWith("/storage/fonts/")) {
|
||||||
location = "/storage/fonts/" + location;
|
location = "/storage/fonts/" + location;
|
||||||
}
|
}
|
||||||
this.location = location;
|
this.location = location;
|
||||||
@@ -39,10 +36,6 @@ public class ParabotFont {
|
|||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Font getFont() {
|
public Font getFont() {
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
@@ -52,10 +45,8 @@ public class ParabotFont {
|
|||||||
if (obj != null) {
|
if (obj != null) {
|
||||||
if (obj instanceof ParabotFont) {
|
if (obj instanceof ParabotFont) {
|
||||||
ParabotFont otherFont = (ParabotFont) obj;
|
ParabotFont otherFont = (ParabotFont) obj;
|
||||||
if (otherFont.getName().equalsIgnoreCase(this.getName())) {
|
if (otherFont.getSize() == this.getSize()) {
|
||||||
if (otherFont.getSize() == this.getSize()) {
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user