From 34e16ada5d04d16629f6121b1c90cb6774f545df Mon Sep 17 00:00:00 2001 From: feschi55 Date: Thu, 18 Dec 2014 17:11:08 +0100 Subject: [PATCH] =?UTF-8?q?Schriftarten=20implementiert=20in=20ActionPanel?= =?UTF-8?q?,=20powerUp=20Methode=20hinzugef=C3=BCgt,?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HeatUp/src/de/heatup/ui/FontLoader.java | 2 +- HeatUp/src/de/heatup/ui/StatusPanelAdder.java | 22 ++++++++++++++++--- .../heatup/ui/actionPanel/ActionControl.java | 15 +++++++++++-- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/HeatUp/src/de/heatup/ui/FontLoader.java b/HeatUp/src/de/heatup/ui/FontLoader.java index 28f8726..f443707 100644 --- a/HeatUp/src/de/heatup/ui/FontLoader.java +++ b/HeatUp/src/de/heatup/ui/FontLoader.java @@ -28,7 +28,7 @@ public class FontLoader { } - public Font getFont(){ + public static Font getFont(){ return ttfBase; } diff --git a/HeatUp/src/de/heatup/ui/StatusPanelAdder.java b/HeatUp/src/de/heatup/ui/StatusPanelAdder.java index e74aebd..bc9c240 100644 --- a/HeatUp/src/de/heatup/ui/StatusPanelAdder.java +++ b/HeatUp/src/de/heatup/ui/StatusPanelAdder.java @@ -29,12 +29,15 @@ public class StatusPanelAdder{ private static double tempPlus=0.0; private static double tempMinus=0.0; 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 JLabel labelTempC= new JLabel("§"); private static JLabel labelTemp= new JLabel("temperature"); private static JProgressBar tempBar; 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 powerUpLabel = new JLabel(/*new ImageIcon("path_to_image.png")*/"powerUpLabel"); private static JLabel labelTime=new JLabel("Time"); @@ -43,6 +46,7 @@ public class StatusPanelAdder{ private static Font emulogictext; private static Font ttfBase; 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)); panel=newPanel; } + public static void setPUText(String s){ + powerUpLabel.setText(s); + } /** * erhöht die Anzahl Manipulationen */ @@ -96,7 +103,7 @@ public class StatusPanelAdder{ timeLabel.setText(Timer.getMinuteS() + ":" + Timer.getSecondsS()); /** - * Temperaturbearbeitung + * Temperaturaktualisierung */ labelTempC.setText(tempBar.getValue() + "°C"); temping=0; @@ -115,6 +122,15 @@ public class StatusPanelAdder{ 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){ Logger.write("Temperatur: " + tempBar.getValue()); @@ -138,7 +154,7 @@ public class StatusPanelAdder{ * fügt dem der Klasse übergebenen Panel Objekte hinzu & formatiert diese */ public static void createPanel(){ - ttfBase=fl.getFont(); + ttfBase=FontLoader.getFont(); emulogicheading = ttfBase.deriveFont(Font.PLAIN, 16); emulogictext= ttfBase.deriveFont(Font.PLAIN, 12); diff --git a/HeatUp/src/de/heatup/ui/actionPanel/ActionControl.java b/HeatUp/src/de/heatup/ui/actionPanel/ActionControl.java index e0018a1..57e41ae 100644 --- a/HeatUp/src/de/heatup/ui/actionPanel/ActionControl.java +++ b/HeatUp/src/de/heatup/ui/actionPanel/ActionControl.java @@ -7,6 +7,7 @@ import java.awt.Font; import javax.swing.*; import de.heatup.mapengine.MapGrid; +import de.heatup.ui.FontLoader; import de.heatup.ui.Main; public class ActionControl{ @@ -22,15 +23,25 @@ public class ActionControl{ private static JLabel bigActionLabel; private static int tmpCount=0; 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){ + emulogicaction = ttfBase.deriveFont(Font.PLAIN, 12); + emulogicbigaction= ttfBase.deriveFont(Font.LAYOUT_RIGHT_TO_LEFT, 25); + panel = newPanel; + panel.setBackground(Color.BLACK); actionLabel = new JLabel(); bigActionLabel = new JLabel(); 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); - 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.setHorizontalAlignment(JLabel.CENTER); bigActionLabel.setVisible(false);