- Diagonal lines are no longer removed.
This commit is contained in:
@@ -3,7 +3,6 @@ package view;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@@ -29,11 +28,11 @@ public class UserChooserFrame extends JFrame {
|
||||
"Here should go some rules text. Lorem ipsum dolor sit amet, consectetur adipiscing elit...");
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final Player comPlayer;
|
||||
private final JButton playButton = new JButton("Play!");
|
||||
private final JComboBox<String> userNameBox = new JComboBox<String>();
|
||||
private ArrayList<String> users;
|
||||
private final Player comPlayer;
|
||||
|
||||
|
||||
public UserChooserFrame(ParsedArgs parsedArgs) {
|
||||
this.comPlayer = parsedArgs.getComPlayer();
|
||||
initLayout();
|
||||
@@ -78,36 +77,13 @@ public class UserChooserFrame extends JFrame {
|
||||
for (int i = 0; i < users.size(); i++) {
|
||||
userNameBox.addItem(users.get(i));
|
||||
}
|
||||
|
||||
|
||||
ActionListener psActionListener = new PlayerSelectActionListener(this);
|
||||
|
||||
|
||||
userNameBox.addActionListener(psActionListener);
|
||||
playButton.addActionListener(psActionListener);
|
||||
}
|
||||
|
||||
void launchSelectedPlayer() {
|
||||
String name = ((String) userNameBox.getSelectedItem());
|
||||
name = name == null ? name : name.trim().toLowerCase();
|
||||
|
||||
if (name != null && name.compareTo("") != 0) {
|
||||
UserChooserFrame.this.setVisible(false);
|
||||
|
||||
boolean found = false;
|
||||
for (int i = 0; !found && i < users.size(); i++) {
|
||||
if (name.compareTo(users.get(i)) == 0) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
users.add(name);
|
||||
}
|
||||
|
||||
saveUserList();
|
||||
new MainFrame(name, comPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
private void initLayout() {
|
||||
GridBagLayout gbl = new GridBagLayout();
|
||||
|
||||
@@ -165,4 +141,27 @@ public class UserChooserFrame extends JFrame {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
void launchSelectedPlayer() {
|
||||
String name = ((String) userNameBox.getSelectedItem());
|
||||
name = name == null ? name : name.trim().toLowerCase();
|
||||
|
||||
if (name != null && name.compareTo("") != 0) {
|
||||
UserChooserFrame.this.setVisible(false);
|
||||
|
||||
boolean found = false;
|
||||
for (int i = 0; !found && i < users.size(); i++) {
|
||||
if (name.compareTo(users.get(i)) == 0) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
users.add(name);
|
||||
}
|
||||
|
||||
saveUserList();
|
||||
new MainFrame(name, comPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user