Example usage for javax.swing JButton setHorizontalAlignment

List of usage examples for javax.swing JButton setHorizontalAlignment

Introduction

In this page you can find the example usage for javax.swing JButton setHorizontalAlignment.

Prototype

@BeanProperty(visualUpdate = true, enumerationValues = { "SwingConstants.LEFT", "SwingConstants.CENTER",
        "SwingConstants.RIGHT", "SwingConstants.LEADING",
        "SwingConstants.TRAILING" }, description = "The horizontal alignment of the icon and text.")
public void setHorizontalAlignment(int alignment) 

Source Link

Document

Sets the horizontal alignment of the icon and text.

Usage

From source file:MovingIconTest.java

public static void main(String args[]) {
    JFrame frame = new JFrame();
    Container contentPane = frame.getContentPane();

    JButton b;
    Icon icon = new PieIcon(Color.red);
    b = new JButton("Default", icon);
    contentPane.add(b, BorderLayout.NORTH);
    b = new JButton("Text Left", icon);
    b.setHorizontalTextPosition(JButton.LEFT);
    contentPane.add(b, BorderLayout.SOUTH);
    b = new JButton("Text Up", icon);
    b.setHorizontalTextPosition(JButton.CENTER);
    b.setVerticalTextPosition(JButton.TOP);
    contentPane.add(b, BorderLayout.EAST);
    b = new JButton("Text Down", icon);
    b.setHorizontalTextPosition(JButton.CENTER);
    b.setVerticalTextPosition(JButton.BOTTOM);
    contentPane.add(b, BorderLayout.WEST);
    b = new JButton("Align Bottom Left", icon);
    b.setHorizontalAlignment(JButton.LEFT);
    b.setVerticalAlignment(JButton.BOTTOM);
    contentPane.add(b, BorderLayout.CENTER);
    frame.setSize(300, 200);//from w w w .  j ava2  s.  com
    frame.show();
}

From source file:MainClass.java

MainClass(String title) {
    super(title);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JButton jb = new JButton("Ok", new ImageIcon("bullet.gif"));
    jb.setHorizontalAlignment(SwingConstants.LEFT);
    jb.setMnemonic('O');

    getContentPane().add(jb, BorderLayout.CENTER);

    jb = new JButton("<html><i>Cancel</i></html>");
    jb.setVerticalAlignment(SwingConstants.BOTTOM);

    jb.setDefaultCapable(true);/*from w  ww . jav a2  s .c  o m*/

    getContentPane().add(jb, BorderLayout.EAST);

    getRootPane().setDefaultButton(jb);

    setSize(200, 100);
    setVisible(true);
}

From source file:eu.delving.sip.Application.java

private JPanel createButtonPanel() {
    JPanel p = new JPanel(new GridLayout(0, 1));
    JButton b;
    p.add(b = new JButton(unlockMappingAction));
    b.setHorizontalAlignment(JButton.LEFT);
    p.add(b = new JButton(selectAnotherMappingAction));
    b.setHorizontalAlignment(JButton.LEFT);
    p.add(b = new JButton(importAction));
    b.setHorizontalAlignment(JButton.LEFT);
    return p;// w ww  . jav a  2s  . com
}

From source file:com.web.vehiclerouting.optaplanner.common.swingui.SolverAndPersistenceFrame.java

private JComponent createQuickOpenPanel(List<Action> quickOpenActionList, List<File> fileList, String title) {
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    if (fileList.isEmpty()) {
        JLabel noneLabel = new JLabel("None");
        noneLabel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
        panel.add(noneLabel);//from w w w .j a  v a2s.c om
    } else {
        for (File file : fileList) {
            Action quickOpenAction = new QuickOpenAction(file);
            quickOpenActionList.add(quickOpenAction);
            JButton quickOpenButton = new JButton(quickOpenAction);
            quickOpenButton.setHorizontalAlignment(SwingConstants.LEFT);
            quickOpenButton.setMargin(new Insets(0, 0, 0, 0));
            panel.add(quickOpenButton);
        }
    }
    JScrollPane scrollPane = new JScrollPane(panel);
    scrollPane.getVerticalScrollBar().setUnitIncrement(25);
    scrollPane.setMinimumSize(new Dimension(100, 80));
    // Size fits into screen resolution 1024*768
    scrollPane.setPreferredSize(new Dimension(180, 200));
    JPanel titlePanel = new JPanel(new BorderLayout());
    titlePanel.add(scrollPane, BorderLayout.CENTER);
    titlePanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2),
            BorderFactory.createTitledBorder(title)));
    return titlePanel;
}

From source file:misc.ModalityDemo.java

/**
 * Create the GUI and show it.  For thread safety,
 * this method is invoked from the/*w  ww  . jav  a2  s .co  m*/
 * event-dispatching thread.
 */
private void createAndShowGUI() {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();
    GraphicsConfiguration gc = gd.getDefaultConfiguration();
    Insets ins = Toolkit.getDefaultToolkit().getScreenInsets(gc);
    int sw = gc.getBounds().width - ins.left - ins.right;
    int sh = gc.getBounds().height - ins.top - ins.bottom;

    // first document

    // frame f1

    f1 = new JFrame("Book 1 (parent frame)");
    f1.setBounds(32, 32, 300, 200);
    f1.addWindowListener(closeWindow);
    // create radio buttons
    rb11 = new JRadioButton("Biography", true);
    rb12 = new JRadioButton("Funny tale", false);
    rb13 = new JRadioButton("Sonnets", false);
    // place radio buttons into a single group
    ButtonGroup bg1 = new ButtonGroup();
    bg1.add(rb11);
    bg1.add(rb12);
    bg1.add(rb13);
    JButton b1 = new JButton("OK");
    b1.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            // get label of selected radiobutton
            String title = null;
            if (rb11.isSelected()) {
                title = rb11.getText();
            } else if (rb12.isSelected()) {
                title = rb12.getText();
            } else {
                title = rb13.getText();
            }
            // prepend radio button label to dialogs' titles
            d2.setTitle(title + " (modeless dialog)");
            d3.setTitle(title + " (document-modal dialog)");
            d2.setVisible(true);
        }
    });
    Container cp1 = f1.getContentPane();
    // create three containers to improve layouting
    cp1.setLayout(new GridLayout(1, 3));
    // an empty container
    Container cp11 = new Container();
    // a container to layout components
    Container cp12 = new Container();
    // an empty container
    Container cp13 = new Container();
    // add a button into a separate panel
    JPanel p1 = new JPanel();
    p1.setLayout(new FlowLayout());
    p1.add(b1);
    // add radio buttons and the OK button one after another into a single column
    cp12.setLayout(new GridLayout(4, 1));
    cp12.add(rb11);
    cp12.add(rb12);
    cp12.add(rb13);
    cp12.add(p1);
    // add three containers
    cp1.add(cp11);
    cp1.add(cp12);
    cp1.add(cp13);

    // dialog d2

    d2 = new JDialog(f1);
    d2.setBounds(132, 132, 300, 200);
    d2.addWindowListener(closeWindow);
    JLabel l2 = new JLabel("Enter your name: ");
    l2.setHorizontalAlignment(SwingConstants.CENTER);
    tf2 = new JTextField(12);
    JButton b2 = new JButton("OK");
    b2.setHorizontalAlignment(SwingConstants.CENTER);
    b2.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            //pass a name into the document modal dialog
            l3.setText("by " + tf2.getText());
            d3.setVisible(true);
        }
    });
    Container cp2 = d2.getContentPane();
    // add label, text field and button one after another into a single column
    cp2.setLayout(new BorderLayout());
    cp2.add(l2, BorderLayout.NORTH);
    cp2.add(tf2, BorderLayout.CENTER);
    JPanel p2 = new JPanel();
    p2.setLayout(new FlowLayout());
    p2.add(b2);
    cp2.add(p2, BorderLayout.SOUTH);

    // dialog d3

    d3 = new JDialog(d2, "", Dialog.ModalityType.DOCUMENT_MODAL);
    d3.setBounds(232, 232, 300, 200);
    d3.addWindowListener(closeWindow);
    JTextArea ta3 = new JTextArea();
    l3 = new JLabel();
    l3.setHorizontalAlignment(SwingConstants.RIGHT);
    Container cp3 = d3.getContentPane();
    cp3.setLayout(new BorderLayout());
    cp3.add(new JScrollPane(ta3), BorderLayout.CENTER);
    JPanel p3 = new JPanel();
    p3.setLayout(new FlowLayout(FlowLayout.RIGHT));
    p3.add(l3);
    cp3.add(p3, BorderLayout.SOUTH);

    // second document

    // frame f4

    f4 = new JFrame("Book 2 (parent frame)");
    f4.setBounds(sw - 300 - 32, 32, 300, 200);
    f4.addWindowListener(closeWindow);
    // create radio buttons
    rb41 = new JRadioButton("Biography", true);
    rb42 = new JRadioButton("Funny tale", false);
    rb43 = new JRadioButton("Sonnets", false);
    // place radio buttons into a single group
    ButtonGroup bg4 = new ButtonGroup();
    bg4.add(rb41);
    bg4.add(rb42);
    bg4.add(rb43);
    JButton b4 = new JButton("OK");
    b4.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            // get label of selected radiobutton
            String title = null;
            if (rb41.isSelected()) {
                title = rb41.getText();
            } else if (rb42.isSelected()) {
                title = rb42.getText();
            } else {
                title = rb43.getText();
            }
            // prepend radiobutton label to dialogs' titles
            d5.setTitle(title + " (modeless dialog)");
            d6.setTitle(title + " (document-modal dialog)");
            d5.setVisible(true);
        }
    });
    Container cp4 = f4.getContentPane();
    // create three containers to improve layouting
    cp4.setLayout(new GridLayout(1, 3));
    Container cp41 = new Container();
    Container cp42 = new Container();
    Container cp43 = new Container();
    // add the button into a separate panel
    JPanel p4 = new JPanel();
    p4.setLayout(new FlowLayout());
    p4.add(b4);
    // add radiobuttons and the OK button one after another into a single column
    cp42.setLayout(new GridLayout(4, 1));
    cp42.add(rb41);
    cp42.add(rb42);
    cp42.add(rb43);
    cp42.add(p4);
    //add three containers
    cp4.add(cp41);
    cp4.add(cp42);
    cp4.add(cp43);

    // dialog d5

    d5 = new JDialog(f4);
    d5.setBounds(sw - 400 - 32, 132, 300, 200);
    d5.addWindowListener(closeWindow);
    JLabel l5 = new JLabel("Enter your name: ");
    l5.setHorizontalAlignment(SwingConstants.CENTER);
    tf5 = new JTextField(12);
    tf5.setHorizontalAlignment(SwingConstants.CENTER);
    JButton b5 = new JButton("OK");
    b5.setHorizontalAlignment(SwingConstants.CENTER);
    b5.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            //pass a name into the document modal dialog
            l6.setText("by " + tf5.getText());
            d6.setVisible(true);
        }
    });
    Container cp5 = d5.getContentPane();
    // add label, text field and button one after another into a single column
    cp5.setLayout(new BorderLayout());
    cp5.add(l5, BorderLayout.NORTH);
    cp5.add(tf5, BorderLayout.CENTER);
    JPanel p5 = new JPanel();
    p5.setLayout(new FlowLayout());
    p5.add(b5);
    cp5.add(p5, BorderLayout.SOUTH);

    // dialog d6

    d6 = new JDialog(d5, "", Dialog.ModalityType.DOCUMENT_MODAL);
    d6.setBounds(sw - 500 - 32, 232, 300, 200);
    d6.addWindowListener(closeWindow);
    JTextArea ta6 = new JTextArea();
    l6 = new JLabel();
    l6.setHorizontalAlignment(SwingConstants.RIGHT);
    Container cp6 = d6.getContentPane();
    cp6.setLayout(new BorderLayout());
    cp6.add(new JScrollPane(ta6), BorderLayout.CENTER);
    JPanel p6 = new JPanel();
    p6.setLayout(new FlowLayout(FlowLayout.RIGHT));
    p6.add(l6);
    cp6.add(p6, BorderLayout.SOUTH);

    // third document

    // frame f7

    f7 = new JFrame("Classics (excluded frame)");
    f7.setModalExclusionType(Dialog.ModalExclusionType.APPLICATION_EXCLUDE);
    f7.setBounds(32, sh - 200 - 32, 300, 200);
    f7.addWindowListener(closeWindow);
    JLabel l7 = new JLabel("Famous writers: ");
    l7.setHorizontalAlignment(SwingConstants.CENTER);
    // create radio buttons
    rb71 = new JRadioButton("Burns", true);
    rb72 = new JRadioButton("Dickens", false);
    rb73 = new JRadioButton("Twain", false);
    // place radio buttons into a single group
    ButtonGroup bg7 = new ButtonGroup();
    bg7.add(rb71);
    bg7.add(rb72);
    bg7.add(rb73);
    Container cp7 = f7.getContentPane();
    // create three containers to improve layouting
    cp7.setLayout(new GridLayout(1, 3));
    Container cp71 = new Container();
    Container cp72 = new Container();
    Container cp73 = new Container();
    // add the label into a separate panel
    JPanel p7 = new JPanel();
    p7.setLayout(new FlowLayout());
    p7.add(l7);
    // add a label and radio buttons one after another into a single column
    cp72.setLayout(new GridLayout(4, 1));
    cp72.add(p7);
    cp72.add(rb71);
    cp72.add(rb72);
    cp72.add(rb73);
    // add three containers
    cp7.add(cp71);
    cp7.add(cp72);
    cp7.add(cp73);

    // fourth document

    // frame f8

    f8 = new JFrame("Feedback (parent frame)");
    f8.setBounds(sw - 300 - 32, sh - 200 - 32, 300, 200);
    f8.addWindowListener(closeWindow);
    JButton b8 = new JButton("Rate yourself");
    b8.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JOptionPane.showConfirmDialog(null, "I really like my book", "Question (application-modal dialog)",
                    JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
        }
    });
    Container cp8 = f8.getContentPane();
    cp8.setLayout(new FlowLayout(FlowLayout.CENTER, 8, 8));
    cp8.add(b8);
}

From source file:com.employee.scheduler.common.swingui.SolverAndPersistenceFrame.java

private void refreshQuickOpenPanel(JPanel panel, List<Action> quickOpenActionList, List<File> fileList) {
    panel.removeAll();/*w  w  w . j a va2 s  .  c  o  m*/
    quickOpenActionList.clear();
    if (fileList.isEmpty()) {
        JLabel noneLabel = new JLabel("None");
        noneLabel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
        panel.add(noneLabel);
    } else {
        for (File file : fileList) {
            Action quickOpenAction = new QuickOpenAction(file);
            quickOpenActionList.add(quickOpenAction);
            JButton quickOpenButton = new JButton(quickOpenAction);
            quickOpenButton.setHorizontalAlignment(SwingConstants.LEFT);
            quickOpenButton.setMargin(new Insets(0, 0, 0, 0));
            panel.add(quickOpenButton);
        }
    }
}

From source file:de.ailis.xadrian.frames.MainFrame.java

/**
 * Creates the content./*from  w  w w.ja  va 2s  .c  om*/
 */
private void createContent() {
    this.tabs = new JTabbedPane();
    this.tabs.setPreferredSize(new Dimension(640, 480));
    this.tabs.addChangeListener(this);
    this.tabs.setTransferHandler(this.transferHandler);

    final JPanel welcomePanel = this.welcomePanel = new JPanel();
    welcomePanel.setTransferHandler(this.transferHandler);

    welcomePanel.setLayout(new GridBagLayout());
    final GridBagConstraints c = new GridBagConstraints();

    welcomePanel.setPreferredSize(new Dimension(640, 480));
    final JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new GridBagLayout());
    c.anchor = GridBagConstraints.CENTER;
    welcomePanel.add(buttonPanel, c);

    final JButton newButton = new JButton(this.newAction);
    newButton.setHorizontalAlignment(SwingConstants.LEFT);
    newButton.setIconTextGap(10);
    newButton.setText("<html><body><strong>" + newButton.getText() + "</strong><br />"
            + newButton.getToolTipText() + "</body></html>");
    newButton.setToolTipText(null);
    newButton.setMargin(new Insets(5, 10, 5, 10));
    c.gridy = 0;
    c.fill = GridBagConstraints.BOTH;
    c.insets.set(5, 5, 5, 5);
    buttonPanel.add(newButton, c);

    final JButton openButton = new JButton(this.openAction);
    openButton.setHorizontalAlignment(SwingConstants.LEFT);
    openButton.setIconTextGap(10);
    openButton.setText("<html><body><strong>" + openButton.getText() + "</strong><br />"
            + openButton.getToolTipText() + "</body></html>");
    openButton.setToolTipText(null);
    openButton.setMargin(new Insets(5, 10, 5, 10));
    c.gridy++;
    buttonPanel.add(openButton, c);

    final JPanel separator = new JPanel();
    separator.setPreferredSize(new Dimension(20, 20));
    c.gridy++;
    buttonPanel.add(separator, c);

    final JButton donateButton = new JButton(this.donateAction);
    donateButton.setHorizontalAlignment(SwingConstants.LEFT);
    donateButton.setIconTextGap(10);
    donateButton.setText("<html><body><strong>" + donateButton.getText() + "</strong><br />"
            + donateButton.getToolTipText() + "</body></html>");
    donateButton.setToolTipText(null);
    donateButton.setMargin(new Insets(5, 10, 5, 10));
    c.gridy++;
    buttonPanel.add(donateButton, c);

    final SocialPane socialPane = new SocialPane();
    c.insets.top = 50;
    c.gridy++;
    buttonPanel.add(socialPane, c);
    installStatusHandler(buttonPanel);

    add(welcomePanel, BorderLayout.CENTER);
}

From source file:com.rapidminer.gui.viewer.metadata.AttributeStatisticsPanel.java

/**
 * Updates the charts.//from   w w w  . ja v a  2  s . co m
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
private void updateCharts() {
    for (int i = 0; i < listOfChartPanels.size(); i++) {
        JPanel panel = listOfChartPanels.get(i);
        panel.removeAll();
        final ChartPanel chartPanel = new ChartPanel(getModel().getChartOrNull(i)) {

            private static final long serialVersionUID = -6953213567063104487L;

            @Override
            public Dimension getPreferredSize() {
                return DIMENSION_CHART_PANEL_ENLARGED;
            }
        };
        chartPanel.setPopupMenu(null);
        chartPanel.setBackground(COLOR_TRANSPARENT);
        chartPanel.setOpaque(false);
        chartPanel.addMouseListener(enlargeAndHoverAndPopupMouseAdapter);
        panel.add(chartPanel, BorderLayout.CENTER);

        JPanel openChartPanel = new JPanel(new GridBagLayout());
        openChartPanel.setOpaque(false);

        GridBagConstraints gbc = new GridBagConstraints();
        gbc.anchor = GridBagConstraints.CENTER;
        gbc.fill = GridBagConstraints.NONE;
        gbc.weightx = 1.0;
        gbc.weighty = 1.0;

        JButton openChartButton = new JButton(OPEN_CHART_ACTION);
        openChartButton.setOpaque(false);
        openChartButton.setContentAreaFilled(false);
        openChartButton.setBorderPainted(false);
        openChartButton.addMouseListener(enlargeAndHoverAndPopupMouseAdapter);
        openChartButton.setHorizontalAlignment(SwingConstants.LEFT);
        openChartButton.setHorizontalTextPosition(SwingConstants.LEFT);
        openChartButton.setIcon(null);
        Font font = openChartButton.getFont();
        Map attributes = font.getAttributes();
        attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
        openChartButton.setFont(font.deriveFont(attributes).deriveFont(10.0f));

        openChartPanel.add(openChartButton, gbc);

        panel.add(openChartPanel, BorderLayout.SOUTH);
        panel.revalidate();
        panel.repaint();
    }
}

From source file:org.jets3t.apps.uploader.Uploader.java

/**
 * Configures a button's text, tooltip and image using uploader properties prefixed
 * with the given properties prefix.//  w w w. ja v  a 2  s. c o m
 *
 * @param button
 * @param propertiesPrefix
 */
private void configureButton(JButton button, String propertiesPrefix) {
    button.setHorizontalAlignment(JLabel.CENTER);

    String buttonImagePath = uploaderProperties.getStringProperty(propertiesPrefix + ".image", null);
    String buttonText = replaceMessageVariables(
            uploaderProperties.getStringProperty(propertiesPrefix + ".text", null));
    String buttonTooltip = replaceMessageVariables(
            uploaderProperties.getStringProperty(propertiesPrefix + ".tooltip", null));

    boolean hasImage = false;
    boolean hasText = false;

    if (buttonImagePath != null && buttonImagePath.length() > 0) {
        if (!guiUtils.applyIcon(button, buttonImagePath)) {
            log.error("Unable to load image URL for a button with property prefix '" + propertiesPrefix
                    + "'. Image path: " + buttonImagePath);
        } else {
            hasImage = true;
        }
    }
    if (buttonText != null && buttonText.length() > 0) {
        String text = replaceMessageVariables(buttonText);
        button.setText(text);
        button.setMnemonic(text.charAt(0));
        hasText = true;
    }
    if (buttonTooltip != null && buttonTooltip.length() > 0) {
        button.setToolTipText(buttonTooltip);
    }

    if (!hasImage && !hasText) {
        button.setVisible(false);
    } else {
        button.setVisible(true);
    }
}

From source file:net.technicpack.launcher.ui.LauncherFrame.java

private void initComponents() {
    BorderLayout layout = new BorderLayout();
    setLayout(layout);/*from  w w w . j  a v a2 s.co m*/

    /////////////////////////////////////////////////////////////
    //HEADER
    /////////////////////////////////////////////////////////////
    JPanel header = new JPanel();
    header.setLayout(new BoxLayout(header, BoxLayout.LINE_AXIS));
    header.setBackground(COLOR_BLUE);
    header.setForeground(COLOR_WHITE_TEXT);
    header.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 10));
    this.add(header, BorderLayout.PAGE_START);

    ImageIcon headerIcon = resources.getIcon("platform_icon_title.png");
    JButton headerLabel = new JButton(headerIcon);
    headerLabel.setBorder(BorderFactory.createEmptyBorder(5, 8, 5, 0));
    headerLabel.setContentAreaFilled(false);
    headerLabel.setFocusPainted(false);
    headerLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    headerLabel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            DesktopUtils.browseUrl("http://beta.technicpack.net/");
        }
    });
    header.add(headerLabel);

    header.add(Box.createRigidArea(new Dimension(6, 0)));

    ActionListener tabListener = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            selectTab(e.getActionCommand());
        }
    };

    discoverTab = new HeaderTab(resources.getString("launcher.title.discover"), resources);
    header.add(discoverTab);
    discoverTab.setActionCommand(TAB_DISCOVER);
    discoverTab.addActionListener(tabListener);

    modpacksTab = new HeaderTab(resources.getString("launcher.title.modpacks"), resources);
    modpacksTab.setIsActive(true);
    modpacksTab.setHorizontalTextPosition(SwingConstants.LEADING);
    modpacksTab.addActionListener(tabListener);
    modpacksTab.setActionCommand(TAB_MODPACKS);
    header.add(modpacksTab);

    newsTab = new HeaderTab(resources.getString("launcher.title.news"), resources);
    newsTab.setLayout(null);
    newsTab.addActionListener(tabListener);
    newsTab.setActionCommand(TAB_NEWS);
    header.add(newsTab);

    CountCircle newsCircle = new CountCircle();
    newsCircle.setBackground(COLOR_RED);
    newsCircle.setForeground(COLOR_WHITE_TEXT);
    newsCircle.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS_BOLD, 14));
    newsTab.add(newsCircle);
    newsCircle.setBounds(10, 17, 25, 25);

    header.add(Box.createHorizontalGlue());

    JPanel rightHeaderPanel = new JPanel();
    rightHeaderPanel.setOpaque(false);
    rightHeaderPanel.setLayout(new BoxLayout(rightHeaderPanel, BoxLayout.PAGE_AXIS));
    rightHeaderPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));

    JPanel windowGadgetPanel = new JPanel();
    windowGadgetPanel.setOpaque(false);
    windowGadgetPanel.setLayout(new BoxLayout(windowGadgetPanel, BoxLayout.LINE_AXIS));
    windowGadgetPanel.setAlignmentX(RIGHT_ALIGNMENT);

    ImageIcon minimizeIcon = resources.getIcon("minimize.png");
    JButton minimizeButton = new JButton(minimizeIcon);
    minimizeButton.setBorder(BorderFactory.createEmptyBorder());
    minimizeButton.setContentAreaFilled(false);
    minimizeButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
    minimizeButton.setFocusable(false);
    minimizeButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            minimizeWindow();
        }
    });
    windowGadgetPanel.add(minimizeButton);

    ImageIcon closeIcon = resources.getIcon("close.png");
    JButton closeButton = new JButton(closeIcon);
    closeButton.setBorder(BorderFactory.createEmptyBorder());
    closeButton.setContentAreaFilled(false);
    closeButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            closeWindow();
        }
    });
    closeButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
    closeButton.setFocusable(false);
    windowGadgetPanel.add(closeButton);

    rightHeaderPanel.add(windowGadgetPanel);
    rightHeaderPanel.add(Box.createVerticalGlue());

    JButton launcherOptionsLabel = new JButton(resources.getString("launcher.title.options"));
    launcherOptionsLabel.setIcon(resources.getIcon("options_cog.png"));
    launcherOptionsLabel.setFont(resources.getFont(ResourceLoader.FONT_RALEWAY, 14));
    launcherOptionsLabel.setForeground(COLOR_WHITE_TEXT);
    launcherOptionsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    launcherOptionsLabel.setHorizontalTextPosition(SwingConstants.LEADING);
    launcherOptionsLabel.setAlignmentX(RIGHT_ALIGNMENT);
    launcherOptionsLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    launcherOptionsLabel.setBorder(BorderFactory.createEmptyBorder());
    launcherOptionsLabel.setContentAreaFilled(false);
    launcherOptionsLabel.setFocusPainted(false);
    launcherOptionsLabel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            openLauncherOptions();
        }
    });
    rightHeaderPanel.add(launcherOptionsLabel);

    header.add(rightHeaderPanel);

    /////////////////////////////////////////////////////////////
    // CENTRAL AREA
    /////////////////////////////////////////////////////////////
    centralPanel = new TintablePanel();
    centralPanel.setBackground(COLOR_CHARCOAL);
    centralPanel.setForeground(COLOR_WHITE_TEXT);
    centralPanel.setTintColor(COLOR_CENTRAL_BACK);
    this.add(centralPanel, BorderLayout.CENTER);
    centralPanel.setLayout(new BorderLayout());

    modpackPanel = new ModpackInfoPanel(resources, iconRepo, logoRepo, backgroundRepo, avatarRepo,
            new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    openModpackOptions((ModpackModel) e.getSource());
                }
            }, new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    refreshModpackOptions((ModpackModel) e.getSource());
                }
            });
    modpackSelector.setInfoPanel(modpackPanel);
    playButton = modpackPanel.getPlayButton();
    playButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (e.getSource() instanceof ModpackModel) {
                setupPlayButtonText((ModpackModel) e.getSource(), userModel.getCurrentUser());
            } else if (installer.isCurrentlyRunning()) {
                installer.cancel();
                setupPlayButtonText(modpackSelector.getSelectedPack(), userModel.getCurrentUser());
            } else {
                launchModpack();
            }
        }
    });

    modpackPanel.getDeleteButton().addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (JOptionPane.showConfirmDialog(LauncherFrame.this,
                    resources.getString("modpackoptions.delete.confirmtext"),
                    resources.getString("modpackoptions.delete.confirmtitle"),
                    JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
                modpackSelector.getSelectedPack().delete();
                modpackSelector.forceRefresh();
            }
        }
    });

    infoSwap = new JPanel();
    infoLayout = new CardLayout();
    infoSwap.setLayout(infoLayout);
    infoSwap.setOpaque(false);
    newsInfoPanel = new NewsInfoPanel(resources, avatarRepo);
    infoSwap.add(discoverInfoPanel, "discover");

    JPanel newsHost = new JPanel();
    infoSwap.add(newsHost, "news");
    JPanel modpackHost = new JPanel();
    infoSwap.add(modpackHost, "modpacks");
    centralPanel.add(infoSwap, BorderLayout.CENTER);

    newsSelector = new NewsSelector(resources, newsInfoPanel, platformApi, avatarRepo, newsCircle, settings);
    newsHost.setLayout(new BorderLayout());
    newsHost.add(newsInfoPanel, BorderLayout.CENTER);
    newsHost.add(newsSelector, BorderLayout.WEST);

    modpackHost.setLayout(new BorderLayout());
    modpackHost.add(modpackPanel, BorderLayout.CENTER);
    modpackHost.add(modpackSelector, BorderLayout.WEST);

    footer = new TintablePanel();
    footer.setTintColor(COLOR_CENTRAL_BACK);
    footer.setBackground(COLOR_FOOTER);
    footer.setLayout(new BoxLayout(footer, BoxLayout.LINE_AXIS));
    footer.setForeground(COLOR_WHITE_TEXT);
    footer.setBorder(BorderFactory.createEmptyBorder(3, 6, 3, 12));

    userWidget = new UserWidget(resources, skinRepository);
    userWidget.setMaximumSize(userWidget.getPreferredSize());
    footer.add(userWidget);

    JLabel dashText = new JLabel("| ");
    dashText.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    dashText.setFont(resources.getFont(ResourceLoader.FONT_RALEWAY, 15));
    footer.add(dashText);

    JButton logout = new JButton(resources.getString("launcher.user.logout"));
    logout.setBorder(BorderFactory.createEmptyBorder());
    logout.setContentAreaFilled(false);
    logout.setFocusable(false);
    logout.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    logout.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    logout.setFont(resources.getFont(ResourceLoader.FONT_RALEWAY, 15));
    logout.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            logout();
        }
    });
    footer.add(logout);

    installProgress = new ProgressBar();
    installProgress.setForeground(Color.white);
    installProgress.setBackground(LauncherFrame.COLOR_GREEN);
    installProgress.setBorder(BorderFactory.createEmptyBorder(5, 45, 4, 45));
    installProgress.setIcon(resources.getIcon("download_icon.png"));
    installProgress.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 12));
    installProgress.setVisible(false);
    footer.add(installProgress);

    installProgressPlaceholder = Box.createHorizontalGlue();
    footer.add(installProgressPlaceholder);

    JLabel buildCtrl = new JLabel(resources.getString("launcher.build.text", resources.getLauncherBuild(),
            resources.getString("launcher.build." + settings.getBuildStream())));
    buildCtrl.setForeground(COLOR_WHITE_TEXT);
    buildCtrl.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 14));
    buildCtrl.setHorizontalTextPosition(SwingConstants.RIGHT);
    buildCtrl.setHorizontalAlignment(SwingConstants.RIGHT);
    footer.add(buildCtrl);

    this.add(footer, BorderLayout.PAGE_END);
}