grobe Weiterleitung fuer startMultiplayerGame an Spiel beitreten/Spiel erstellen eingefügt
This commit is contained in:
parent
6ef3b38dd5
commit
ea6a1c9804
|
@ -0,0 +1,44 @@
|
|||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.*;
|
||||
|
||||
public class JoinGame extends JPanel {
|
||||
JLabel spielBeitretenLabel= new JLabel("Spiel beitreten");
|
||||
JLabel ipLabel = new JLabel("IP-Adresse");
|
||||
JLabel portLabel = new JLabel("Port");
|
||||
|
||||
JTextField ipTextField = new JTextField(20);
|
||||
JTextField portTextField = new JTextField(20);
|
||||
|
||||
JButton losButton = new JButton("Los!");
|
||||
|
||||
Font robotoFont = new Font("Roboto", Font.BOLD, 45);
|
||||
|
||||
public JoinGame(MainFrame frame) {
|
||||
setLayout(null);
|
||||
buildPanel(frame);
|
||||
}
|
||||
|
||||
private void buildPanel(MainFrame frame) {
|
||||
spielBeitretenLabel.setBounds(20,20,700, 100);
|
||||
losButton.setBounds(320, 225, 100, 50);
|
||||
|
||||
ipLabel.setBounds(50, 125, 200, 30);
|
||||
portLabel.setBounds(50, 200, 200, 30);
|
||||
|
||||
ipTextField.setBounds(50, 150, 250, 50);
|
||||
portTextField.setBounds(50, 225, 250, 50);
|
||||
|
||||
|
||||
spielBeitretenLabel.setFont(robotoFont.deriveFont(50f));
|
||||
|
||||
add(spielBeitretenLabel);
|
||||
add(ipLabel);
|
||||
add(portLabel);
|
||||
add(losButton);
|
||||
add(ipTextField);
|
||||
add(portTextField);
|
||||
}
|
||||
|
||||
}
|
|
@ -12,6 +12,12 @@ public class MainFrame extends JFrame {
|
|||
setSize(1500, 1000);
|
||||
setLocationRelativeTo(null);
|
||||
|
||||
//JLabel backgroundLabel = new JLabel(new ImageIcon("graphics/mainmenubackground.png"));
|
||||
// backgroundLabel.setBounds(0, 0, 1500, 1000);
|
||||
// getContentPane().add(backgroundLabel);
|
||||
|
||||
// backgroundLabel.setOpaque(true);
|
||||
|
||||
// CardLayout und Hauptpanel erstellen
|
||||
cardLayout = new CardLayout();
|
||||
mainPanel = new JPanel(cardLayout);
|
||||
|
@ -21,12 +27,13 @@ public class MainFrame extends JFrame {
|
|||
startLocalGame localGame = new startLocalGame(this);
|
||||
startMultiplayerGame multiplayerGame = new startMultiplayerGame(this);
|
||||
coinToss coinToss = new coinToss(this);
|
||||
JoinGame joinGame = new JoinGame(this);
|
||||
|
||||
mainPanel.add(mainMenuView, "MainMenu");
|
||||
mainPanel.add(localGame, "LocalGame");
|
||||
mainPanel.add(multiplayerGame, "MultiplayerGame");
|
||||
mainPanel.add(coinToss, "coinToss");
|
||||
|
||||
mainPanel.add(joinGame, "JoinGame");
|
||||
// Hauptpanel in JFrame hinzufügen
|
||||
add(mainPanel);
|
||||
|
||||
|
|
|
@ -107,7 +107,9 @@ public class startMultiplayerGame extends JPanel {
|
|||
});
|
||||
|
||||
// ActionListener für den "Back" Button, um zum vorherigen Panel zurückzukehren
|
||||
|
||||
backButton.addActionListener(e -> frame.showPanel("MainMenu"));
|
||||
joinGameButton.addActionListener(e -> frame.showPanel("JoinGame"));
|
||||
}
|
||||
|
||||
// TOGGLE METHODEN
|
||||
|
|
Loading…
Reference in New Issue