mirror of
https://github.com/jokerx3/HeatUp
synced 2026-07-27 09:59:45 +02:00
Merge branch 'master' of github.com:jokerx3/prp
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package de.heatup.ui;
|
||||
|
||||
import java.awt.Font;
|
||||
import java.awt.FontFormatException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import de.heatup.logging.Logger;
|
||||
|
||||
public class FontLoader {
|
||||
static Font ttfBase;
|
||||
|
||||
|
||||
public FontLoader() {
|
||||
ClassLoader cl = this.getClass().getClassLoader();
|
||||
InputStream is = cl.getResourceAsStream("de/heatup/resources/fonts/emulogic.ttf");
|
||||
try {
|
||||
ttfBase = Font.createFont(Font.TRUETYPE_FONT, is);
|
||||
} catch (FontFormatException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Logger.write("Font de/heatup/resources/fonts/emulogic.ttf loaded");
|
||||
|
||||
|
||||
}
|
||||
|
||||
public Font getFont(){
|
||||
return ttfBase;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -6,6 +6,8 @@ import java.awt.Component;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Font;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
@@ -40,21 +42,10 @@ public class StatusPanelAdder{
|
||||
private static Font emulogicheading;
|
||||
private static Font emulogictext;
|
||||
private static Font ttfBase;
|
||||
private static FontLoader fl=new FontLoader();
|
||||
|
||||
private static Font implementFont(){
|
||||
String fontFileName = "emulogic.ttf";
|
||||
File ttf= new File("src/de/heatup/resources/fonts/" + fontFileName);
|
||||
|
||||
try {
|
||||
ttfBase = Font.createFont(Font.TRUETYPE_FONT, ttf);
|
||||
|
||||
}catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
System.err.println(ttf.getAbsolutePath());
|
||||
}
|
||||
Logger.write("Font implemented");
|
||||
return ttfBase;
|
||||
}
|
||||
public static void raiseMod(){
|
||||
if (modifier==-1){
|
||||
modifier=1;
|
||||
@@ -138,7 +129,7 @@ public class StatusPanelAdder{
|
||||
* fügt dem der Klasse übergebenen Panel Objekte hinzu & formatiert diese
|
||||
*/
|
||||
public static void createPanel(){
|
||||
implementFont();
|
||||
ttfBase=fl.getFont();
|
||||
emulogicheading = ttfBase.deriveFont(Font.PLAIN, 16);
|
||||
emulogictext= ttfBase.deriveFont(Font.PLAIN, 12);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user