예제 #1
0
    public ManageScreen(String type, Screen callerScreen) {
      caller = callerScreen;

      Eve.setLayout(new MigLayout("wrap 3", "[][grow 25][grow 75]", "[][][grow]"));
      this.type = type;

      back.addActionListener(
          (ActionEvent e) -> {
            caller.refresh();
            caller.Return();
          });
      addB.setMargin(new Insets(0, 0, 0, 0));
      addB.addActionListener(
          (ActionEvent e) -> {
            if (type.matches("player")) {
              new ModifyPlayerPopup(null, this, null);
            } else if (type.matches("team")) {
              called = new ModifyTeamScreen(null, this);
              called.Switch();
            }
          });

      view.setBorder(BorderFactory.createLineBorder(Color.black));

      viewScroll.getVerticalScrollBar().setUnitIncrement(16);

      this.drawScreen();
    }
예제 #2
0
 public BrowseScreen(Screen caller) {
   Eve.setLayout(new MigLayout("flowy", "grow, fill", "[][grow, fill]"));
   this.caller = caller;
   back.addActionListener(
       (ActionEvent e) -> {
         caller.Return();
       });
   Eve.add(back);
   Eve.add(pool.pool);
 }
예제 #3
0
 public DraftScreen(Team team, Screen caller) {
   Eve = new JPanel(new MigLayout("wrap 2", "[grow, center, fill][grow, fill]"));
   this.team = team;
   this.caller = caller;
   back.addActionListener(
       (ActionEvent e) -> {
         caller.refresh();
         caller.Return();
       });
   Object[] options = {"Us", "Them"};
   JFrame frame = new JFrame();
   firstPick =
       JOptionPane.showOptionDialog(
           frame,
           "Who has first pick?",
           "",
           JOptionPane.YES_NO_OPTION,
           JOptionPane.QUESTION_MESSAGE,
           null,
           options,
           options[1]);
   draft = new Draft(firstPick, myPicks, myBans, enemyPicks, enemyBans);
   drawScreen();
 }
예제 #4
0
    public ModifyTeamScreen(Team teamPassed, Screen callerScreen) {

      Eve.setLayout(new MigLayout("flowy", "[grow, fill]", "[][grow, fill]"));

      cancel.addActionListener(
          (ActionEvent e) -> {
            caller.Return();
          });

      save.addActionListener(
          (ActionEvent e) -> {
            team.name = name.getText();
            if (team.globalIndex == -1) {
              team.saveTeam(true);
            } else {
              team.saveTeam(false);
            }
            callerScreen.refresh();
            caller.Return();
          });
      addPlayers.setMargin(new Insets(0, 0, 0, 0));
      addPlayers.addActionListener(
          (ActionEvent e) -> {
            if (team.getPlayers().length < 5) {
              JButton cancelB = new JButton("Cancel");
              cancelB.addActionListener(
                  (ActionEvent f) -> {
                    inner.removeAll();
                    popup.dispose();
                  });
              inner.add(cancelB);
              JButton newPlayer = new JButton("New Player");
              newPlayer.addActionListener(
                  (ActionEvent f) -> {
                    inner.removeAll();
                    popup.dispose();
                    ModifyPlayerPopup addNewPlayer = new ModifyPlayerPopup(null, this, team);
                  });
              inner.add(newPlayer);
              inner.add(new JSeparator(), "growx");
              for (Player player : Global.Players) {
                boolean playerInCurrentTeam = false;
                for (Player teamPlayer : team.getPlayers()) {
                  if (teamPlayer.globalIndex == player.globalIndex) {
                    playerInCurrentTeam = true;
                    break;
                  }
                }
                if (!playerInCurrentTeam) {
                  JPanel oldPlayer = player.playerPreview();
                  JButton choose = new JButton("Add!");
                  choose.addActionListener(
                      (ActionEvent f) -> {
                        team.addPlayer(player);
                        inner.removeAll();
                        popup.dispose();
                        refresh();
                      });
                  oldPlayer.add(choose, "east");
                  oldPlayer.setBorder(BorderFactory.createLineBorder(Color.black));
                  inner.add(oldPlayer);
                }
              }
              innerScroll.getVerticalScrollBar().setUnitIncrement(16);
              innerScroll.setHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_NEVER);
              popup.add(innerScroll);
              popup.setSize(350, 400);
              popup.setLocation(MouseInfo.getPointerInfo().getLocation());
              popup.setVisible(true);
            } else {
              JOptionPane.showMessageDialog(
                  null,
                  "You cannot add more than 5 players per team.\nPlease remove one before adding another.");
            }
          });

      caller = callerScreen;

      drawScreen(teamPassed);
    }