Schriftarten implementiert in ActionPanel, powerUp Methode hinzugefügt,

This commit is contained in:
feschi55
2014-12-18 17:11:08 +01:00
parent 38a9563689
commit 34e16ada5d
3 changed files with 33 additions and 6 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ public class FontLoader {
} }
public Font getFont(){ public static Font getFont(){
return ttfBase; return ttfBase;
} }
+19 -3
View File
@@ -29,12 +29,15 @@ public class StatusPanelAdder{
private static double tempPlus=0.0; private static double tempPlus=0.0;
private static double tempMinus=0.0; private static double tempMinus=0.0;
private static double barSpeed=0.01; private static double barSpeed=0.01;
private static float red;
private static float green;
private static float blue;
private static boolean ende=false; private static boolean ende=false;
private static JLabel labelTempC= new JLabel("§"); private static JLabel labelTempC= new JLabel("§");
private static JLabel labelTemp= new JLabel("temperature"); private static JLabel labelTemp= new JLabel("temperature");
private static JProgressBar tempBar; private static JProgressBar tempBar;
private static JLabel labelScore= new JLabel("score"); private static JLabel labelScore= new JLabel("score");
private static JLabel scoreLabel= new JLabel("new Score Label"); private static JLabel scoreLabel= new JLabel();
private static JLabel labelPowerUp = new JLabel("PowerUp"); private static JLabel labelPowerUp = new JLabel("PowerUp");
private static JLabel powerUpLabel = new JLabel(/*new ImageIcon("path_to_image.png")*/"powerUpLabel"); private static JLabel powerUpLabel = new JLabel(/*new ImageIcon("path_to_image.png")*/"powerUpLabel");
private static JLabel labelTime=new JLabel("Time"); private static JLabel labelTime=new JLabel("Time");
@@ -43,6 +46,7 @@ public class StatusPanelAdder{
private static Font emulogictext; private static Font emulogictext;
private static Font ttfBase; private static Font ttfBase;
private static FontLoader fl=new FontLoader(); private static FontLoader fl=new FontLoader();
private static Color tempBarColor= new Color(0,0,255);
@@ -73,6 +77,9 @@ public class StatusPanelAdder{
newPanel.setLayout(new FlowLayout(FlowLayout.CENTER, hgap,5)); newPanel.setLayout(new FlowLayout(FlowLayout.CENTER, hgap,5));
panel=newPanel; panel=newPanel;
} }
public static void setPUText(String s){
powerUpLabel.setText(s);
}
/** /**
* erhöht die Anzahl Manipulationen * erhöht die Anzahl Manipulationen
*/ */
@@ -96,7 +103,7 @@ public class StatusPanelAdder{
timeLabel.setText(Timer.getMinuteS() + ":" + Timer.getSecondsS()); timeLabel.setText(Timer.getMinuteS() + ":" + Timer.getSecondsS());
/** /**
* Temperaturbearbeitung * Temperaturaktualisierung
*/ */
labelTempC.setText(tempBar.getValue() + "°C"); labelTempC.setText(tempBar.getValue() + "°C");
temping=0; temping=0;
@@ -115,6 +122,15 @@ public class StatusPanelAdder{
tempPlus=-1; tempPlus=-1;
} }
} }
red=((float)(((tempBar.getValue())-30)/80.0));
blue=(1-red);
Logger.write("Color number" + red);
tempBarColor=new Color(red, green,blue, (float)0.65);
tempBar.setForeground(tempBarColor);
if (temping!=0){ if (temping!=0){
Logger.write("Temperatur: " + tempBar.getValue()); Logger.write("Temperatur: " + tempBar.getValue());
@@ -138,7 +154,7 @@ public class StatusPanelAdder{
* fügt dem der Klasse übergebenen Panel Objekte hinzu & formatiert diese * fügt dem der Klasse übergebenen Panel Objekte hinzu & formatiert diese
*/ */
public static void createPanel(){ public static void createPanel(){
ttfBase=fl.getFont(); ttfBase=FontLoader.getFont();
emulogicheading = ttfBase.deriveFont(Font.PLAIN, 16); emulogicheading = ttfBase.deriveFont(Font.PLAIN, 16);
emulogictext= ttfBase.deriveFont(Font.PLAIN, 12); emulogictext= ttfBase.deriveFont(Font.PLAIN, 12);
@@ -7,6 +7,7 @@ import java.awt.Font;
import javax.swing.*; import javax.swing.*;
import de.heatup.mapengine.MapGrid; import de.heatup.mapengine.MapGrid;
import de.heatup.ui.FontLoader;
import de.heatup.ui.Main; import de.heatup.ui.Main;
public class ActionControl{ public class ActionControl{
@@ -22,15 +23,25 @@ public class ActionControl{
private static JLabel bigActionLabel; private static JLabel bigActionLabel;
private static int tmpCount=0; private static int tmpCount=0;
private static boolean keyA=true; private static boolean keyA=true;
private static Font ttfBase=FontLoader.getFont();
private static Font emulogicaction;
private static Font emulogicbigaction;
public static void setPanel(JPanel newPanel){ public static void setPanel(JPanel newPanel){
emulogicaction = ttfBase.deriveFont(Font.PLAIN, 12);
emulogicbigaction= ttfBase.deriveFont(Font.LAYOUT_RIGHT_TO_LEFT, 25);
panel = newPanel; panel = newPanel;
panel.setBackground(Color.BLACK);
actionLabel = new JLabel(); actionLabel = new JLabel();
bigActionLabel = new JLabel(); bigActionLabel = new JLabel();
bar = new JProgressBar(); bar = new JProgressBar();
actionLabel.setFont(new Font("Arial", Font.CENTER_BASELINE, 16)); //actionLabel.setFont(new Font("Arial", Font.CENTER_BASELINE, 16));
actionLabel.setFont(emulogicaction);
actionLabel.setHorizontalAlignment(JLabel.CENTER); actionLabel.setHorizontalAlignment(JLabel.CENTER);
bigActionLabel.setFont(new Font("Arial", Font.LAYOUT_RIGHT_TO_LEFT,40)); actionLabel.setForeground(Color.YELLOW);
//bigActionLabel.setFont(new Font("Arial", Font.LAYOUT_RIGHT_TO_LEFT,40));
bigActionLabel.setFont(emulogicbigaction);
bigActionLabel.setForeground(Color.RED); bigActionLabel.setForeground(Color.RED);
bigActionLabel.setHorizontalAlignment(JLabel.CENTER); bigActionLabel.setHorizontalAlignment(JLabel.CENTER);
bigActionLabel.setVisible(false); bigActionLabel.setVisible(false);