Example usage for javax.swing.plaf.basic BasicScrollBarUI BasicScrollBarUI

List of usage examples for javax.swing.plaf.basic BasicScrollBarUI BasicScrollBarUI

Introduction

In this page you can find the example usage for javax.swing.plaf.basic BasicScrollBarUI BasicScrollBarUI.

Prototype

BasicScrollBarUI

Source Link

Usage

From source file:lol.search.RankedStatsPage.java

private JScrollPane championSelectPanel() {
    JPanel mainPanel = new JPanel(new FlowLayout());
    //mainPanel.setBorder(BorderFactory.createLineBorder(Color.WHITE));
    mainPanel.setBackground(backgroundColor);
    for (int i = 0; i < this.objChampRankedList.size(); i++) {
        int position = counter;
        ImageIcon champImageIcon = this.OBJ_RANKED_STATS_BY_ID.getChampionIconOf(this.champKeyList.get(i));
        JButton champButton = new JButton();
        champButton.setIcon(champImageIcon);
        if (i == 0) {
            champButton.setIcon(this.profileIcon);
            champButton.setToolTipText("Overall Stats");
        }/*from www  . j a va 2 s .  co m*/
        champButton.setPreferredSize(new Dimension(55, 55));
        champButton.setBackground(Color.BLACK);
        champButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) { //button pressed
                background.setIcon(OBJ_GAME_STATIC_DATA.getBackgroundImageIcon(champKeyList.get(position)));
                loadArtLabel.setIcon(OBJ_GAME_STATIC_DATA.initLoadingArt(champKeyList.get(position)));
                nameHeader.setText(OBJ_ALL_CHAMPS_BY_ID.getChampNameFromId(champIdList.get(position)));

                titleHeader.setText(" " + OBJ_ALL_CHAMPS_BY_ID.getChampTitleFromId(champIdList.get(position)));
                String sessionsWon = "";
                String sessionsLost = "";
                String winPercentString = "";
                try {
                    int won = objChampRankedList.get(position).getJSONObject("stats")
                            .getInt("totalSessionsWon");
                    sessionsWon = Integer.toString(won);
                    int lost = objChampRankedList.get(position).getJSONObject("stats")
                            .getInt("totalSessionsLost");
                    sessionsLost = Integer.toString(lost);
                    winPercentString = getWinPercentage(won, lost);
                    totalGamesInt = won + lost;
                    avgKillsLabelValue.setText(new DecimalFormat("##.##")
                            .format((double) objChampRankedList.get(position).getJSONObject("stats")
                                    .getInt("totalChampionKills") / (double) totalGamesInt));
                    avgAssistsLabelValue
                            .setText(new DecimalFormat("##.##").format((double) objChampRankedList.get(position)
                                    .getJSONObject("stats").getInt("totalAssists") / (double) totalGamesInt));
                    avgDeathsLabelValue.setText(new DecimalFormat("##.##")
                            .format((double) objChampRankedList.get(position).getJSONObject("stats")
                                    .getInt("totalDeathsPerSession") / (double) totalGamesInt));
                    avgMinionKillsLabelValue.setText(new DecimalFormat("##.##")
                            .format((double) objChampRankedList.get(position).getJSONObject("stats")
                                    .getInt("totalMinionKills") / (double) totalGamesInt));
                    avgDoubleKillsLabelValue.setText(new DecimalFormat("##.##")
                            .format((double) objChampRankedList.get(position).getJSONObject("stats")
                                    .getInt("totalDoubleKills") / (double) totalGamesInt));
                    avgTripleKillsLabelValue.setText(new DecimalFormat("##.##")
                            .format((double) objChampRankedList.get(position).getJSONObject("stats")
                                    .getInt("totalTripleKills") / (double) totalGamesInt));
                    avgQuadKillsLabelValue.setText(new DecimalFormat("##.##")
                            .format((double) objChampRankedList.get(position).getJSONObject("stats")
                                    .getInt("totalQuadraKills") / (double) totalGamesInt));
                    avgPentaKillsLabelValue.setText(new DecimalFormat("##.##")
                            .format((double) objChampRankedList.get(position).getJSONObject("stats")
                                    .getInt("totalPentaKills") / (double) totalGamesInt));
                    totalKillsLabelValue.setText(new DecimalFormat("#######").format((double) objChampRankedList
                            .get(position).getJSONObject("stats").getInt("totalChampionKills")));
                    totalDeathsLabelValue
                            .setText(new DecimalFormat("#######").format((double) objChampRankedList
                                    .get(position).getJSONObject("stats").getInt("totalDeathsPerSession")));
                    totalAssistsLabelValue
                            .setText(new DecimalFormat("#######").format((double) objChampRankedList
                                    .get(position).getJSONObject("stats").getInt("totalAssists")));
                    totalMinionsLabelValue
                            .setText(new DecimalFormat("#######").format((double) objChampRankedList
                                    .get(position).getJSONObject("stats").getInt("totalMinionKills")));
                    totalDoubleKillsLabelValue
                            .setText(new DecimalFormat("#######").format((double) objChampRankedList
                                    .get(position).getJSONObject("stats").getInt("totalDoubleKills")));
                    totalTripleKillsLabelValue
                            .setText(new DecimalFormat("#######").format((double) objChampRankedList
                                    .get(position).getJSONObject("stats").getInt("totalTripleKills")));
                    totalQuadKillsLabelValue
                            .setText(new DecimalFormat("#######").format((double) objChampRankedList
                                    .get(position).getJSONObject("stats").getInt("totalQuadraKills")));
                    totalPentaKillsLabelValue
                            .setText(new DecimalFormat("#######").format((double) objChampRankedList
                                    .get(position).getJSONObject("stats").getInt("totalPentaKills")));
                } catch (JSONException ex) {
                    Logger.getLogger(RankedStatsPage.class.getName()).log(Level.SEVERE, null, ex);
                }
                totalWins.setText(sessionsWon);
                totalLosses.setText(sessionsLost);
                winPercent.setText(winPercentString + "%");
                totalGamesPlayed.setText(String.valueOf(totalGamesInt));
                masterFrame.revalidate();
                masterFrame.repaint();
            }
        });
        champButton.setToolTipText(OBJ_ALL_CHAMPS_BY_ID.getChampNameFromId(champIdList.get(position)));
        champButtons.add(champButton);
        //champButton.setBorder(BorderFactory.createLineBorder(Color.BLACK));
        counter++;
    }
    for (int i = 0; i < champButtons.size(); i++) {
        mainPanel.add(champButtons.get(i));
        mainPanel.revalidate();
    }
    JScrollPane scrollPane = new JScrollPane(mainPanel);
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
    scrollPane.setPreferredSize(new Dimension(1200, 85));
    scrollPane.setBackground(new Color(0, 0, 0, 100));
    scrollPane.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    scrollPane.getHorizontalScrollBar().setUI(new BasicScrollBarUI() {
        @Override
        protected void configureScrollBarColors() {
            this.thumbColor = new Color(124, 124, 124, 255);
            this.trackColor = Color.BLACK;
        }
    });

    return scrollPane;
}