mirror of
https://github.com/jokerx3/HeatUp
synced 2026-07-27 11:39:45 +02:00
StatusPanelAdder Layout geändert
This commit is contained in:
@@ -1,8 +1,11 @@
|
|||||||
package de.heatup.ui;
|
package de.heatup.ui;
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
import java.awt.FlowLayout;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.GridBagConstraints;
|
import java.awt.GridBagConstraints;
|
||||||
|
import java.awt.GridLayout;
|
||||||
import java.awt.Insets;
|
import java.awt.Insets;
|
||||||
|
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
@@ -34,6 +37,7 @@ public class StatusPanelAdder{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setPanel(JPanel newPanel){
|
public static void setPanel(JPanel newPanel){
|
||||||
|
newPanel.setLayout(new FlowLayout());
|
||||||
panel=newPanel;
|
panel=newPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,12 +49,25 @@ public class StatusPanelAdder{
|
|||||||
JProgressBar tempBar= new JProgressBar(30,90);
|
JProgressBar tempBar= new JProgressBar(30,90);
|
||||||
tempBar.setValue(45);
|
tempBar.setValue(45);
|
||||||
|
|
||||||
|
JPanel tempPanel=new JPanel();
|
||||||
|
tempPanel.setLayout(new BorderLayout());
|
||||||
|
tempPanel.add(labelTemp, BorderLayout.NORTH);
|
||||||
|
tempPanel.add(tempBar, BorderLayout.SOUTH);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
JLabel labelScore= new JLabel("score");
|
JLabel labelScore= new JLabel("score");
|
||||||
labelScore.setFont(new Font("Arial", Font.CENTER_BASELINE, 16));
|
labelScore.setFont(new Font("Arial", Font.CENTER_BASELINE, 16));
|
||||||
//labelScore.setBorder(new LineBorder(Color.BLACK, 1));
|
//labelScore.setBorder(new LineBorder(Color.BLACK, 1));
|
||||||
|
|
||||||
JLabel scoreLabel= new JLabel("new Score Label");
|
JLabel scoreLabel= new JLabel("new Score Label");
|
||||||
scoreLabel.setBorder(new LineBorder(Color.BLACK, 1));
|
//scoreLabel.setBorder(new LineBorder(Color.BLACK, 1));
|
||||||
|
|
||||||
|
JPanel scorePanel=new JPanel();
|
||||||
|
scorePanel.setLayout(new BorderLayout());
|
||||||
|
scorePanel.add(labelScore, BorderLayout.NORTH);
|
||||||
|
scorePanel.add(scoreLabel, BorderLayout.SOUTH);
|
||||||
|
|
||||||
|
|
||||||
JLabel labelPowerUp = new JLabel("PowerUp");
|
JLabel labelPowerUp = new JLabel("PowerUp");
|
||||||
labelPowerUp.setFont(new Font("Arial", Font.CENTER_BASELINE, 16));
|
labelPowerUp.setFont(new Font("Arial", Font.CENTER_BASELINE, 16));
|
||||||
@@ -58,6 +75,10 @@ public class StatusPanelAdder{
|
|||||||
|
|
||||||
JLabel powerUpLabel = new JLabel(/*new ImageIcon("path_to_image.png")*/"powerUpLabel");
|
JLabel powerUpLabel = new JLabel(/*new ImageIcon("path_to_image.png")*/"powerUpLabel");
|
||||||
//powerUpLabel.setBorder(new LineBorder(Color.BLACK, 1));
|
//powerUpLabel.setBorder(new LineBorder(Color.BLACK, 1));
|
||||||
|
JPanel powerUpPanel=new JPanel();
|
||||||
|
powerUpPanel.setLayout(new BorderLayout());
|
||||||
|
powerUpPanel.add(labelPowerUp, BorderLayout.NORTH);
|
||||||
|
powerUpPanel.add(powerUpLabel, BorderLayout.SOUTH);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -65,18 +86,32 @@ public class StatusPanelAdder{
|
|||||||
labelTime.setFont(new Font("Arial", Font.CENTER_BASELINE, 16));
|
labelTime.setFont(new Font("Arial", Font.CENTER_BASELINE, 16));
|
||||||
//labelTime.setBorder(new LineBorder(Color.BLACK, 1));
|
//labelTime.setBorder(new LineBorder(Color.BLACK, 1));
|
||||||
labelTime.setSize(100,10);
|
labelTime.setSize(100,10);
|
||||||
labelTime.setHorizontalTextPosition(SwingConstants.CENTER);
|
//labelTime.setHorizontalTextPosition(SwingConstants.CENTER);
|
||||||
|
|
||||||
JLabel timeLabel = new JLabel();
|
JLabel timeLabel = new JLabel("123456789");
|
||||||
//timeLabel.setBorder(new LineBorder(Color.BLACK, 1));
|
//timeLabel.setBorder(new LineBorder(Color.BLACK, 1));
|
||||||
timeLabel.setText("123456789");
|
|
||||||
timeLabel.setFont(new Font("Arial", Font.ITALIC, 12));
|
timeLabel.setFont(new Font("Arial", Font.ITALIC, 12));
|
||||||
|
|
||||||
|
JPanel timePanel=new JPanel();
|
||||||
|
timePanel.setLayout(new BorderLayout());
|
||||||
|
timePanel.add(labelTime, BorderLayout.NORTH);
|
||||||
|
timePanel.add(timeLabel, BorderLayout.SOUTH);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Insets(int top, int left, int bottom, int right);
|
//Insets(int top, int left, int bottom, int right);
|
||||||
|
|
||||||
//panel.add(timeLabel, );
|
|
||||||
|
|
||||||
|
|
||||||
|
panel.add(timePanel);
|
||||||
|
panel.add(scorePanel);
|
||||||
|
panel.add(tempPanel);
|
||||||
|
panel.add(powerUpPanel);
|
||||||
|
|
||||||
|
|
||||||
|
panel.setVisible(true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user