Search in sources :

Example 1 with HorizontalGallery

use of net.technicpack.ui.controls.feeds.HorizontalGallery in project LauncherV3 by TechnicPack.

the class ModpackInfoPanel method initComponents.

private void initComponents(ImageRepository<ModpackModel> iconRepo, ImageRepository<ModpackModel> logoRepo, ActionListener modpackOptionsListener, IDiscordApi discordApi) {
    setLayout(new BorderLayout());
    background = new TiledBackground(null);
    background.setOpaque(true);
    background.setLayout(new BorderLayout());
    background.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    background.setBackground(LauncherFrame.COLOR_CENTRAL_BACK);
    background.setFilterImage(true);
    this.add(background, BorderLayout.CENTER);
    JPanel layoutPanel = new JPanel();
    layoutPanel.setOpaque(false);
    layoutPanel.setLayout(new BoxLayout(layoutPanel, BoxLayout.PAGE_AXIS));
    layoutPanel.setBorder(BorderFactory.createEmptyBorder(20, 0, 0, 0));
    background.add(layoutPanel, BorderLayout.CENTER);
    banner = new ModpackBanner(resources, iconRepo, modpackOptionsListener);
    banner.setBackground(LauncherFrame.COLOR_BANNER);
    banner.setBorder(BorderFactory.createEmptyBorder(0, 0, 4, 0));
    layoutPanel.add(banner);
    JPanel rootFeedPanel = new JPanel();
    BorderLayout rootFeedLayout = new BorderLayout();
    rootFeedLayout.setVgap(10);
    rootFeedPanel.setLayout(rootFeedLayout);
    rootFeedPanel.setOpaque(false);
    rootFeedPanel.setBorder(BorderFactory.createEmptyBorder(16, 20, 20, 16));
    layoutPanel.add(rootFeedPanel);
    dataDisplay = new ModpackDataDisplay(resources, logoRepo, discordApi);
    rootFeedPanel.add(dataDisplay, BorderLayout.PAGE_START);
    JPanel feedBottom = new JPanel();
    feedBottom.setOpaque(false);
    feedBottom.setLayout(new GridBagLayout());
    rootFeedPanel.add(feedBottom, BorderLayout.CENTER);
    JPanel topline = new JPanel();
    topline.setOpaque(false);
    topline.setLayout(new BoxLayout(topline, BoxLayout.LINE_AXIS));
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.weightx = 1.0;
    constraints.weighty = 0.0;
    constraints.gridwidth = 3;
    constraints.gridheight = 1;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    feedBottom.add(topline, constraints);
    JLabel toplineLabel = new JLabel(resources.getString("launcher.packfeed.title"));
    toplineLabel.setFont(resources.getFont(ResourceLoader.FONT_RALEWAY, 28));
    toplineLabel.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    topline.add(toplineLabel);
    topline.add(Box.createHorizontalGlue());
    JButton leftButton = new JButton(resources.getIcon("status_left.png"));
    leftButton.setBorder(BorderFactory.createEmptyBorder());
    leftButton.setContentAreaFilled(false);
    leftButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            clickLeftFeedButton();
        }
    });
    topline.add(leftButton);
    JButton rightButton = new JButton(resources.getIcon("status_right.png"));
    rightButton.setBorder(BorderFactory.createEmptyBorder());
    rightButton.setContentAreaFilled(false);
    rightButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            clickRightFeedButton();
        }
    });
    topline.add(rightButton);
    JLabel label = new JLabel(resources.getString("launcher.packfeed.noupdates"));
    label.setFont(resources.getFont(ResourceLoader.FONT_RALEWAY, 20));
    label.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    feedGallery = new HorizontalGallery();
    feedGallery.setNoComponentsMessage(label);
    feedGallery.setBackground(LauncherFrame.COLOR_FEED_BACK);
    feedGallery.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
    constraints = new GridBagConstraints();
    constraints.gridx = 0;
    constraints.gridy = 1;
    constraints.weightx = 1.0;
    constraints.weighty = 0.0;
    constraints.gridwidth = 3;
    constraints.gridheight = 1;
    constraints.ipady = 150;
    constraints.fill = GridBagConstraints.BOTH;
    feedBottom.add(feedGallery, constraints);
    constraints = new GridBagConstraints();
    constraints.gridx = 0;
    constraints.gridy = 2;
    constraints.weightx = 1.0;
    constraints.weighty = 0.0;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    Component vertFill = Box.createVerticalStrut(12);
    feedBottom.add(vertFill, constraints);
    deleteButton = new RoundedButton(resources.getString("modpackoptions.delete.text"));
    deleteButton.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    deleteButton.setBorder(BorderFactory.createEmptyBorder(5, 17, 10, 17));
    deleteButton.setBackground(LauncherFrame.COLOR_FOOTER);
    deleteButton.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    deleteButton.setHoverForeground(LauncherFrame.COLOR_BLUE);
    deleteButton.setAlignmentX(RIGHT_ALIGNMENT);
    deleteButton.setFocusable(false);
    deleteButton.setContentAreaFilled(false);
    deleteButton.setShouldShowBackground(true);
    deleteButton.setIconTextGap(8);
    deleteButton.setHoverIcon(new ImageIcon(resources.colorImage(resources.getImage("delete_button.png"), LauncherFrame.COLOR_BLUE)));
    deleteButton.setIcon(new ImageIcon(resources.colorImage(resources.getImage("delete_button.png"), LauncherFrame.COLOR_BUTTON_BLUE)));
    feedBottom.add(deleteButton, new GridBagConstraints(0, 3, 1, 1, 1, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    constraints = new GridBagConstraints();
    constraints.gridx = 1;
    constraints.gridy = 3;
    constraints.weightx = 0.02;
    constraints.weighty = 0.0;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    Component horizFill = Box.createGlue();
    feedBottom.add(horizFill, constraints);
    playButton = new RoundedButton(resources.getString("launcher.pack.launch"));
    playButton.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    playButton.setBorder(BorderFactory.createEmptyBorder(5, 17, 10, 17));
    playButton.setBackground(LauncherFrame.COLOR_FOOTER);
    playButton.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    playButton.setHoverForeground(LauncherFrame.COLOR_BLUE);
    playButton.setAlignmentX(RIGHT_ALIGNMENT);
    playButton.setFocusable(false);
    playButton.setContentAreaFilled(false);
    playButton.setShouldShowBackground(true);
    playButton.setIconTextGap(8);
    constraints = new GridBagConstraints();
    constraints.gridx = 2;
    constraints.gridy = 3;
    constraints.weightx = 0.0;
    constraints.weighty = 0.0;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    feedBottom.add(playButton, constraints);
    feedBottom.add(Box.createVerticalGlue(), new GridBagConstraints(0, 4, 2, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
}
Also used : RoundedButton(net.technicpack.ui.controls.RoundedButton) ActionEvent(java.awt.event.ActionEvent) HorizontalGallery(net.technicpack.ui.controls.feeds.HorizontalGallery) ActionListener(java.awt.event.ActionListener) TiledBackground(net.technicpack.ui.controls.TiledBackground)

Aggregations

ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 RoundedButton (net.technicpack.ui.controls.RoundedButton)1 TiledBackground (net.technicpack.ui.controls.TiledBackground)1 HorizontalGallery (net.technicpack.ui.controls.feeds.HorizontalGallery)1