78 lines
2.6 KiB
Java
78 lines
2.6 KiB
Java
import java.awt.*;
|
|
import javax.swing.*;
|
|
import java.awt.event.ActionEvent;
|
|
import java.awt.event.ActionListener;
|
|
|
|
/*
|
|
TODO: evtl an Lucas: die "JoinGame" muss noch informationen erhalten, welche Spieler erstellt wurden und welches Semester
|
|
Also die startMultiplayerGame muss JoinGame mit parametern für (HumanPlayer/AiEasy/AiNormal/AiHard, Semesteranzahl, Spielername) (3 Parameter) erhalten
|
|
|
|
*/
|
|
|
|
|
|
public class JoinGame extends JPanel {
|
|
ImageIcon backButtonIcon = new ImageIcon("graphics/backButton.png");
|
|
|
|
JLabel spielBeitretenLabel;
|
|
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!");
|
|
JButton backButton = new JButton(backButtonIcon);
|
|
|
|
Font robotoFont = new Font("Roboto", Font.BOLD, 45);
|
|
|
|
public JoinGame(MainFrame frame,int g) {
|
|
setLayout(null);
|
|
buildPanel(frame,g);
|
|
}
|
|
|
|
private void buildPanel(MainFrame frame,int g) {
|
|
if(g==1){
|
|
spielBeitretenLabel= new JLabel("Spiel beitreten");
|
|
}else{
|
|
spielBeitretenLabel= new JLabel("Spiel erstellen");
|
|
}
|
|
|
|
spielBeitretenLabel.setBounds(20,20,700, 100);
|
|
losButton.setBounds(320, 225, 100, 50);
|
|
backButton.setBounds(1380, 20, 80, 80);
|
|
|
|
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);
|
|
add(backButton);
|
|
|
|
backButton.addActionListener(e -> frame.showPanel("MultiplayerGame"));
|
|
losButton.addActionListener(e -> frame.showPanel("Verbinden"));
|
|
/*
|
|
losButton.addActionListener(new ActionListener() {
|
|
@Override
|
|
public void actionPerformed(ActionEvent e) {
|
|
frame.showPanel("Verbinden");
|
|
//public static void startOnlineGame(Class<? extends LocalPlayer> localPlayerClass, String localPlayerName, InetSocketAddress
|
|
// address, int size) throws IOException {
|
|
if(playerType == 1) { //Beispiel (für playertape wäre z.B. 1 humanPlayer etc.)
|
|
GameController.startOnlineGame(HumanPlayer.class, playerName, adress); //
|
|
}
|
|
|
|
}
|
|
});
|
|
*/
|
|
}
|
|
} |