public MainScreen() { Eve.setLayout( new MigLayout( "wrap 2", "[0:0, grow 50, fill][0:0, grow 50, fill]", "[pref!][grow, fill]")); quick.addActionListener( (ActionEvent e) -> { DraftScreen draft = new DraftScreen(null, this); draft.Switch(); }); viewAll.addActionListener( (ActionEvent e) -> { called = new BrowseScreen(this); called.Switch(); }); manageTeams.addActionListener( (ActionEvent e) -> { called = new ManageScreen("team", this); called.Switch(); }); managePlayers.addActionListener( (ActionEvent e) -> { called = new ManageScreen("player", this); called.Switch(); }); teams.setBorder(BorderFactory.createLineBorder(Color.black)); players.setBorder(BorderFactory.createLineBorder(Color.black)); teamScroll.setBorder(BorderFactory.createEmptyBorder()); teamScroll.getVerticalScrollBar().setUnitIncrement(16); teamScroll.setHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_NEVER); playerScroll.setBorder(BorderFactory.createEmptyBorder()); playerScroll.getVerticalScrollBar().setUnitIncrement(16); playerScroll.setHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_NEVER); this.drawScreen(); Adam.setMinimumSize(windowSize); Adam.setLocationRelativeTo(null); Adam.setVisible(true); }
@Override void refresh() { Adam.revalidate(); Adam.setMinimumSize(windowSize); Adam.setSize(windowSize); Adam.repaint(); }
@Override void Switch() { Adam.remove(caller.Eve); Adam.add(Eve); Adam.revalidate(); Adam.setMinimumSize(windowSize); Adam.repaint(); }
@Override void Return() { Adam.remove(called.Eve); Adam.add(Eve); Adam.revalidate(); Adam.setMinimumSize(windowSize); Adam.repaint(); }
void drawScreen() { teams.add(myTeams); teams.add(manageTeams, "growx"); teams.add(new JSeparator(), "growx"); for (Team team : Global.Teams) { JPanel thisTeam = team.teamPreview(); JButton startTeam = new JButton("Draft!"); startTeam.addActionListener( (ActionEvent e) -> { DraftScreen called = new DraftScreen(team, this); called.Switch(); }); thisTeam.add(startTeam, "east"); thisTeam.setBorder(BorderFactory.createLineBorder(Color.black)); teamsInner.add(thisTeam, "growx"); } teams.add(teamScroll); players.add(myPlayers); players.add(managePlayers, "growx"); players.add(new JSeparator()); for (Player player : Global.Players) { JPanel thisPlayer = player.playerPreview(); JButton modify = new JButton(ResourceRetriever.getImage("edit.png", 16, 16)); modify.setMargin(new Insets(0, 0, 0, 0)); modify.addActionListener( (ActionEvent e) -> { new ModifyPlayerPopup(player, this, null); }); thisPlayer.add(modify, "east"); thisPlayer.setBorder(BorderFactory.createLineBorder(Color.black)); playersInner.add(thisPlayer, "growx"); } players.add(playerScroll); teamDraft.add(teamDraftL, "span, center"); teamDraft.add(teams, "grow"); teamDraft.add(players, "grow"); Eve.add(quick); Eve.add(viewAll); Eve.add(teamDraft, "span"); Adam.add(Eve); Adam.setSize(windowSize); }
void drawScreen() { matchup.add(teamName); matchup.add(new JLabel("vs.")); matchup.add(enemyName); myPicksFrame.add(new JLabel("picks"), "span, center, wrap"); for (JLabel portait : myPicks) { myPicksPortraits.add(portait); } myPicksFrame.add(myPicksPortraits); theirPicks.add(new JLabel("picks"), "span, center, wrap"); for (JLabel portait : enemyPicks) { theirPicksPortraits.add(portait); } theirPicks.add(theirPicksPortraits); myBansFrame.add(new JLabel("bans"), "span, center, wrap"); for (JLabel portait : myBans) { myBansPortraits.add(portait); } myBansFrame.add(myBansPortraits); theirBans.add(new JLabel("bans"), "span, center, wrap"); for (JLabel portait : enemyBans) { theirBansPortraits.add(portait); } theirBans.add(theirBansPortraits); if (team == null) { allyPool = new PoolBuilder(false, "small", null, null); players.add(allyPool.pool); } else { for (Player player : team.getPlayers()) { players.add(new JLabel(player.name)); JPanel heroes = new JPanel(new MigLayout("", "[grow 49, fill][grow 1][grow 49, fill]")); JPanel regHeroes = new JPanel(new WrapLayout(FlowLayout.LEADING)); JPanel stunHeroes = new JPanel(new WrapLayout(FlowLayout.LEADING)); int numOfStuns = 0; for (Hero hero : player.getPlayList()) { if (hero.hasCharacteristic(Global.Characteristics.RSTUN)) { stunHeroes.add(new JLabel(hero.portraitSmall)); numOfStuns++; } else { regHeroes.add(new JLabel(hero.portraitSmall)); } } heroes.add(regHeroes); if (numOfStuns > 0) { heroes.add(new JSeparator(SwingConstants.VERTICAL), "growy"); heroes.add(stunHeroes); } heroes.setBorder(BorderFactory.createLineBorder(Color.black)); players.add(heroes); } } enemyPool = new PoolBuilder(false, "small", new Returner(), null); theirPool.add(enemyPool.pool); Eve.add(matchup, "span, grow"); Eve.add(myPicksFrame, "c"); Eve.add(theirPicks, "c"); Eve.add(myBansFrame, "c"); Eve.add(theirBans, "c"); // Eve.add(players, "top, span"); Eve.add(theirPool); // Eve.add(back); Adam.setSize(windowSize); }