Commit e79617ac authored by 9831111's avatar 9831111 🙂

Add OkButton Action Listener .

parent b2012589
...@@ -2,6 +2,8 @@ import javax.swing.*; ...@@ -2,6 +2,8 @@ import javax.swing.*;
import javax.swing.border.LineBorder; import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder; import javax.swing.border.TitledBorder;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class CreateNewGameFrame extends JFrame { public class CreateNewGameFrame extends JFrame {
private JPanel settingPanel; private JPanel settingPanel;
...@@ -110,6 +112,17 @@ public class CreateNewGameFrame extends JFrame { ...@@ -110,6 +112,17 @@ public class CreateNewGameFrame extends JFrame {
settingPanel.add(optionPanel, BorderLayout.SOUTH); settingPanel.add(optionPanel, BorderLayout.SOUTH);
} }
class OkButtonAction implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
gameDetails = tankHealthSlider.getValue() + " " + shotDamageSlider.getValue() + " " + destructibleWallSlider.getValue();
String data = gameNameText.getText() + " " + gameMode.getSelectedItem().toString() + " " + gameFinishMode.getSelectedItem().toString() + " " + playerNumber.getSelectedItem().toString() + " 0 " + gameDetails;
writeToFile(data);
dispose();
new OnlineModeFrame();
}
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment