GUI Bug Fix
This commit is contained in:
@@ -37,7 +37,7 @@ public class Dashboard_GUI extends JPanel{
|
|||||||
private JPanel game = new JPanel();
|
private JPanel game = new JPanel();
|
||||||
private JPanel start = new JPanel();
|
private JPanel start = new JPanel();
|
||||||
private CardLayout cl = new CardLayout();
|
private CardLayout cl = new CardLayout();
|
||||||
private Spielerverwaltung spielerverwaltung = new Spielerverwaltung();
|
private Spielerverwaltung spielerverwaltung;
|
||||||
private final JPanel panel = new JPanel();
|
private final JPanel panel = new JPanel();
|
||||||
private final JPanel panel_1 = new JPanel();
|
private final JPanel panel_1 = new JPanel();
|
||||||
private JComboBox<String> spielername = new JComboBox<String>();
|
private JComboBox<String> spielername = new JComboBox<String>();
|
||||||
@@ -78,9 +78,10 @@ public class Dashboard_GUI extends JPanel{
|
|||||||
//Moving Image
|
//Moving Image
|
||||||
|
|
||||||
|
|
||||||
public Dashboard_GUI(Spiel Spiel, Texturenpakete texturen) {
|
public Dashboard_GUI(Spiel Spiel, Texturenpakete texturen, Spielerverwaltung speicherung) {
|
||||||
setMinimumSize(new Dimension(1000, 600));
|
setMinimumSize(new Dimension(1000, 600));
|
||||||
texturenpakete = texturen;
|
texturenpakete = texturen;
|
||||||
|
spielerverwaltung = speicherung;
|
||||||
|
|
||||||
|
|
||||||
System.out.println("DASHBOARD_GUI: Aktives: " + texturenpakete.getAktivesPaket());
|
System.out.println("DASHBOARD_GUI: Aktives: " + texturenpakete.getAktivesPaket());
|
||||||
@@ -88,10 +89,12 @@ public class Dashboard_GUI extends JPanel{
|
|||||||
aktuellesSpiel = Spiel;
|
aktuellesSpiel = Spiel;
|
||||||
setLayout(new BorderLayout(0, 0));
|
setLayout(new BorderLayout(0, 0));
|
||||||
panelCont.setLayout(cl);
|
panelCont.setLayout(cl);
|
||||||
|
highscore.setBackground(new Color(51, 51, 153));
|
||||||
panelCont.add(highscore, "1");
|
panelCont.add(highscore, "1");
|
||||||
|
game.setBackground(new Color(102, 102, 153));
|
||||||
panelCont.add(game, "2");
|
panelCont.add(game, "2");
|
||||||
game.setLayout(new BorderLayout(0, 0));
|
game.setLayout(new BorderLayout(0, 0));
|
||||||
spielfeld.setBackground(new Color(128, 128, 128));
|
spielfeld.setBackground(new Color(102, 102, 153));
|
||||||
|
|
||||||
game.add(spielfeld, BorderLayout.CENTER);
|
game.add(spielfeld, BorderLayout.CENTER);
|
||||||
spielfeld.setLayout(new BorderLayout(0, 0));
|
spielfeld.setLayout(new BorderLayout(0, 0));
|
||||||
@@ -105,13 +108,15 @@ public class Dashboard_GUI extends JPanel{
|
|||||||
spielfeld.add(player_hand, BorderLayout.SOUTH);
|
spielfeld.add(player_hand, BorderLayout.SOUTH);
|
||||||
|
|
||||||
JScrollPane spielerkartenpane = new JScrollPane();
|
JScrollPane spielerkartenpane = new JScrollPane();
|
||||||
|
spielerkartenpane.setBorder(null);
|
||||||
|
spielerkartenpane.setBackground(new Color(51, 51, 153));
|
||||||
spielerkartenpane.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
spielerkartenpane.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
||||||
spielerkartenpane.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
|
spielerkartenpane.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
|
||||||
spielerkartenpane.setPreferredSize(new Dimension(100, 240));
|
spielerkartenpane.setPreferredSize(new Dimension(100, 240));
|
||||||
player_hand.add(spielerkartenpane, BorderLayout.CENTER);
|
player_hand.add(spielerkartenpane, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
|
||||||
spielerkarten.setBackground(Color.GRAY);
|
spielerkarten.setBackground(new Color(51, 51, 153));
|
||||||
spielerkarten.setAutoscrolls(true);
|
spielerkarten.setAutoscrolls(true);
|
||||||
spielerkarten.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
spielerkarten.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
||||||
spielerkarten.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
spielerkarten.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
||||||
@@ -119,13 +124,16 @@ public class Dashboard_GUI extends JPanel{
|
|||||||
gegner_hand.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
|
gegner_hand.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
|
||||||
|
|
||||||
gegner_hand.setPreferredSize(new Dimension(10, 150));
|
gegner_hand.setPreferredSize(new Dimension(10, 150));
|
||||||
gegner_hand.setBackground(Color.GRAY);
|
gegner_hand.setBackground(new Color(102, 102, 153));
|
||||||
gegner_hand.setLayout(new BorderLayout(0, 0));
|
gegner_hand.setLayout(new BorderLayout(0, 0));
|
||||||
spielfeld.add(gegner_hand, BorderLayout.NORTH);
|
spielfeld.add(gegner_hand, BorderLayout.NORTH);
|
||||||
|
gegnerkartenpane.setBorder(null);
|
||||||
|
gegnerkartenpane.setBackground(new Color(102, 102, 153));
|
||||||
gegnerkartenpane.setPreferredSize(new Dimension(100, 140));
|
gegnerkartenpane.setPreferredSize(new Dimension(100, 140));
|
||||||
gegnerkartenpane.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
|
gegnerkartenpane.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
|
||||||
|
|
||||||
gegner_hand.add(gegnerkartenpane, BorderLayout.CENTER);
|
gegner_hand.add(gegnerkartenpane, BorderLayout.CENTER);
|
||||||
|
gegnerkarten.setBackground(new Color(51, 51, 153));
|
||||||
gegnerkarten.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
|
gegnerkarten.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
|
||||||
gegnerkarten.setPreferredSize(new Dimension(10, 140));
|
gegnerkarten.setPreferredSize(new Dimension(10, 140));
|
||||||
|
|
||||||
@@ -135,19 +143,23 @@ public class Dashboard_GUI extends JPanel{
|
|||||||
spielfeldmitte.setLayout(new BorderLayout(0, 0));
|
spielfeldmitte.setLayout(new BorderLayout(0, 0));
|
||||||
JLabel beschreibung_aktuellerSpieler = new JLabel("Aktueller Spieler:");
|
JLabel beschreibung_aktuellerSpieler = new JLabel("Aktueller Spieler:");
|
||||||
beschreibung_aktuellerSpieler.setFont(new Font("Tahoma", Font.BOLD, 18));
|
beschreibung_aktuellerSpieler.setFont(new Font("Tahoma", Font.BOLD, 18));
|
||||||
beschreibung_aktuellerSpieler.setForeground(Color.BLACK);
|
beschreibung_aktuellerSpieler.setForeground(new Color(255, 255, 255));
|
||||||
|
info_panel.setBackground(new Color(51, 51, 153));
|
||||||
info_panel.add(beschreibung_aktuellerSpieler);
|
info_panel.add(beschreibung_aktuellerSpieler);
|
||||||
label_aktuellerSpieler = new JLabel("Auswahlphase");
|
label_aktuellerSpieler = new JLabel("Auswahlphase");
|
||||||
label_aktuellerSpieler.setForeground(Color.BLACK);
|
label_aktuellerSpieler.setForeground(new Color(255, 255, 255));
|
||||||
label_aktuellerSpieler.setFont(new Font("Tahoma", Font.BOLD, 18));
|
label_aktuellerSpieler.setFont(new Font("Tahoma", Font.BOLD, 18));
|
||||||
info_panel.add(label_aktuellerSpieler);
|
info_panel.add(label_aktuellerSpieler);
|
||||||
|
|
||||||
spielfeld.add(spielfeldmitte, BorderLayout.CENTER);
|
spielfeld.add(spielfeldmitte, BorderLayout.CENTER);
|
||||||
spielfeldmitte.add(info_panel, BorderLayout.NORTH);
|
spielfeldmitte.add(info_panel, BorderLayout.NORTH);
|
||||||
|
rechts.setBackground(new Color(51, 51, 153));
|
||||||
rechts.setPreferredSize(new Dimension(250, 10));
|
rechts.setPreferredSize(new Dimension(250, 10));
|
||||||
spielfeldmitte.add(rechts, BorderLayout.EAST);
|
spielfeldmitte.add(rechts, BorderLayout.EAST);
|
||||||
rechts.setLayout(new BorderLayout(0, 0));
|
rechts.setLayout(new BorderLayout(0, 0));
|
||||||
|
ziehstapel.setBackground(new Color(51, 51, 153));
|
||||||
rechts.add(ziehstapel, BorderLayout.CENTER);
|
rechts.add(ziehstapel, BorderLayout.CENTER);
|
||||||
|
mitte.setBackground(new Color(102, 102, 153));
|
||||||
|
|
||||||
spielfeldmitte.add(mitte, BorderLayout.CENTER);
|
spielfeldmitte.add(mitte, BorderLayout.CENTER);
|
||||||
aussetzen.setVisible(false);
|
aussetzen.setVisible(false);
|
||||||
@@ -159,6 +171,7 @@ public class Dashboard_GUI extends JPanel{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
mitte.setLayout(new BorderLayout(0, 0));
|
mitte.setLayout(new BorderLayout(0, 0));
|
||||||
|
mitte_unten.setBackground(new Color(51, 51, 153));
|
||||||
mitte_unten.setPreferredSize(new Dimension(150, 50));
|
mitte_unten.setPreferredSize(new Dimension(150, 50));
|
||||||
mitte_unten.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
mitte_unten.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
||||||
btnherz.setVisible(false);
|
btnherz.setVisible(false);
|
||||||
@@ -166,7 +179,9 @@ public class Dashboard_GUI extends JPanel{
|
|||||||
|
|
||||||
mitte_unten.add(btnherz);
|
mitte_unten.add(btnherz);
|
||||||
mitte_unten.add(aussetzen);
|
mitte_unten.add(aussetzen);
|
||||||
|
mitte_center.setBackground(new Color(51, 51, 153));
|
||||||
mitte_center.setLayout(new BorderLayout(0, 0));
|
mitte_center.setLayout(new BorderLayout(0, 0));
|
||||||
|
ablagestapel.setBackground(new Color(51, 51, 153));
|
||||||
ablagestapel.setHorizontalAlignment(SwingConstants.CENTER);
|
ablagestapel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
ablagestapel.setHorizontalTextPosition(SwingConstants.CENTER);
|
ablagestapel.setHorizontalTextPosition(SwingConstants.CENTER);
|
||||||
ablagestapel.setAlignmentX(Component.CENTER_ALIGNMENT);
|
ablagestapel.setAlignmentX(Component.CENTER_ALIGNMENT);
|
||||||
@@ -180,7 +195,7 @@ public class Dashboard_GUI extends JPanel{
|
|||||||
label_final.setVisible(false);
|
label_final.setVisible(false);
|
||||||
label_final.setFont(new Font("Tahoma", Font.PLAIN, 34));
|
label_final.setFont(new Font("Tahoma", Font.PLAIN, 34));
|
||||||
label_final.setHorizontalAlignment(SwingConstants.CENTER);
|
label_final.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
label_final.setForeground(Color.BLACK);
|
label_final.setForeground(new Color(255, 255, 255));
|
||||||
|
|
||||||
mitte_center.add(label_final, BorderLayout.SOUTH);
|
mitte_center.add(label_final, BorderLayout.SOUTH);
|
||||||
|
|
||||||
@@ -225,20 +240,23 @@ public class Dashboard_GUI extends JPanel{
|
|||||||
});
|
});
|
||||||
|
|
||||||
mitte_unten.add(btnkreuz);
|
mitte_unten.add(btnkreuz);
|
||||||
|
mitte_oben.setBackground(new Color(51, 51, 153));
|
||||||
mitte_oben.setPreferredSize(new Dimension(150, 50));
|
mitte_oben.setPreferredSize(new Dimension(150, 50));
|
||||||
|
|
||||||
mitte.add(mitte_oben, BorderLayout.NORTH);
|
mitte.add(mitte_oben, BorderLayout.NORTH);
|
||||||
mitte_oben.setLayout(new BorderLayout(0, 0));
|
mitte_oben.setLayout(new BorderLayout(0, 0));
|
||||||
start.setBackground(Color.WHITE);
|
start.setBackground(new Color(51, 51, 153));
|
||||||
start.setForeground(Color.WHITE);
|
start.setForeground(Color.WHITE);
|
||||||
panelCont.add(start, "3");
|
panelCont.add(start, "3");
|
||||||
start.setLayout(new BorderLayout(0, 0));
|
start.setLayout(new BorderLayout(0, 0));
|
||||||
panel.setBackground(Color.WHITE);
|
panel.setBackground(new Color(51, 51, 153));
|
||||||
panel.setPreferredSize(new Dimension(10, 30));
|
panel.setPreferredSize(new Dimension(10, 30));
|
||||||
|
|
||||||
start.add(panel, BorderLayout.NORTH);
|
start.add(panel, BorderLayout.NORTH);
|
||||||
|
|
||||||
JLabel lblNewLabel = new JLabel("Spielername:");
|
JLabel lblNewLabel = new JLabel("Spielername:");
|
||||||
|
lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 13));
|
||||||
|
lblNewLabel.setForeground(new Color(255, 255, 255));
|
||||||
panel.add(lblNewLabel);
|
panel.add(lblNewLabel);
|
||||||
spielername.setMinimumSize(new Dimension(60, 22));
|
spielername.setMinimumSize(new Dimension(60, 22));
|
||||||
spielername.setEditable(true);
|
spielername.setEditable(true);
|
||||||
@@ -250,29 +268,35 @@ public class Dashboard_GUI extends JPanel{
|
|||||||
getspielername();
|
getspielername();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
panel_1.setBackground(Color.WHITE);
|
panel_1.setBackground(new Color(51, 51, 153));
|
||||||
start.add(panel_1, BorderLayout.CENTER);
|
start.add(panel_1, BorderLayout.CENTER);
|
||||||
panel_1.setLayout(new BorderLayout(0, 0));
|
panel_1.setLayout(new BorderLayout(0, 0));
|
||||||
panel_3.setBackground(Color.WHITE);
|
panel_3.setBackground(new Color(51, 51, 153));
|
||||||
panel_3.setPreferredSize(new Dimension(100, 50));
|
panel_3.setPreferredSize(new Dimension(100, 40));
|
||||||
|
|
||||||
panel_1.add(panel_3, BorderLayout.NORTH);
|
panel_1.add(panel_3, BorderLayout.NORTH);
|
||||||
|
level_beschreibung.setForeground(new Color(255, 255, 255));
|
||||||
level_beschreibung.setHorizontalTextPosition(SwingConstants.CENTER);
|
level_beschreibung.setHorizontalTextPosition(SwingConstants.CENTER);
|
||||||
level_beschreibung.setHorizontalAlignment(SwingConstants.CENTER);
|
level_beschreibung.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
level_beschreibung.setFont(new Font("Tahoma", Font.PLAIN, 22));
|
level_beschreibung.setFont(new Font("Tahoma", Font.PLAIN, 22));
|
||||||
|
|
||||||
panel_3.add(level_beschreibung);
|
panel_3.add(level_beschreibung);
|
||||||
|
level_count.setForeground(new Color(255, 255, 255));
|
||||||
level_count.setFont(new Font("Tahoma", Font.PLAIN, 22));
|
level_count.setFont(new Font("Tahoma", Font.PLAIN, 22));
|
||||||
|
|
||||||
panel_3.add(level_count);
|
panel_3.add(level_count);
|
||||||
|
lblNewLabel_2.setForeground(Color.LIGHT_GRAY);
|
||||||
lblNewLabel_2.setBackground(Color.LIGHT_GRAY);
|
lblNewLabel_2.setBackground(Color.LIGHT_GRAY);
|
||||||
lblNewLabel_2.setHorizontalTextPosition(SwingConstants.CENTER);
|
lblNewLabel_2.setHorizontalTextPosition(SwingConstants.CENTER);
|
||||||
lblNewLabel_2.setHorizontalAlignment(SwingConstants.CENTER);
|
lblNewLabel_2.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
lblNewLabel_2.setIcon(new ImageIcon(Dashboard_GUI.class.getResource("/img/jaujau.gif")));
|
lblNewLabel_2.setIcon(new ImageIcon(Dashboard_GUI.class.getResource("/img/jaujau.gif")));
|
||||||
|
|
||||||
panel_1.add(lblNewLabel_2, BorderLayout.CENTER);
|
panel_1.add(lblNewLabel_2, BorderLayout.CENTER);
|
||||||
|
panel_2.setBackground(new Color(0, 0, 153));
|
||||||
|
|
||||||
start.add(panel_2, BorderLayout.SOUTH);
|
start.add(panel_2, BorderLayout.SOUTH);
|
||||||
|
lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 14));
|
||||||
|
lblNewLabel_1.setForeground(new Color(255, 255, 255));
|
||||||
|
|
||||||
panel_2.add(lblNewLabel_1);
|
panel_2.add(lblNewLabel_1);
|
||||||
|
|
||||||
@@ -335,6 +359,10 @@ public class Dashboard_GUI extends JPanel{
|
|||||||
String[][] rowData = spielerverwaltung.gethighscoreTabelle(); //Bsp. Datensatz muss noch entfernt werden.
|
String[][] rowData = spielerverwaltung.gethighscoreTabelle(); //Bsp. Datensatz muss noch entfernt werden.
|
||||||
|
|
||||||
String[] columnNames = {"Name", "Punkte"};
|
String[] columnNames = {"Name", "Punkte"};
|
||||||
|
|
||||||
|
for(int i = 0; i < rowData.length; i++) {
|
||||||
|
System.out.println("DASHBOARD_GUI:" + rowData[i][1]);
|
||||||
|
}
|
||||||
highscore.setLayout(new BorderLayout(0, 0));
|
highscore.setLayout(new BorderLayout(0, 0));
|
||||||
JTable table = new JTable(); //Leere Tabelle
|
JTable table = new JTable(); //Leere Tabelle
|
||||||
DefaultTableModel tableModel = new DefaultTableModel(rowData, columnNames) { //Tabelle formatieren und Zellen nicht bearbeitbar machen
|
DefaultTableModel tableModel = new DefaultTableModel(rowData, columnNames) { //Tabelle formatieren und Zellen nicht bearbeitbar machen
|
||||||
|
@@ -129,7 +129,7 @@ public class GUI extends JFrame{
|
|||||||
dashboard.setBackground(new Color(73, 128, 242));
|
dashboard.setBackground(new Color(73, 128, 242));
|
||||||
getContentPane().add(dashboard, BorderLayout.CENTER);
|
getContentPane().add(dashboard, BorderLayout.CENTER);
|
||||||
dashboard.setLayout(new BorderLayout(0, 0));
|
dashboard.setLayout(new BorderLayout(0, 0));
|
||||||
Dashboard_GUI Dashboard_GUI = new Dashboard_GUI(aktuellesSpiel, texturenpakete);
|
Dashboard_GUI Dashboard_GUI = new Dashboard_GUI(aktuellesSpiel, texturenpakete, speicherung);
|
||||||
dashboard.add(Dashboard_GUI, BorderLayout.CENTER);
|
dashboard.add(Dashboard_GUI, BorderLayout.CENTER);
|
||||||
|
|
||||||
//Event Listener für die Buttons / Label
|
//Event Listener für die Buttons / Label
|
||||||
|
Reference in New Issue
Block a user