Search in sources :

Example 1 with RoundedBorderFormatter

use of net.technicpack.ui.controls.list.popupformatters.RoundedBorderFormatter in project LauncherV3 by TechnicPack.

the class LoginFrame method initComponents.

/**
 * Generate & setup UI components for the frame
 */
private void initComponents() {
    setLayout(new GridBagLayout());
    // Close button
    JButton closeButton = new JButton();
    closeButton.setContentAreaFilled(false);
    closeButton.setBorder(BorderFactory.createEmptyBorder());
    closeButton.setIcon(resources.getIcon("close.png"));
    closeButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    closeButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            closeButtonClicked();
        }
    });
    closeButton.setFocusable(false);
    add(closeButton, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(7, 0, 0, 7), 0, 0));
    // Logo at the top
    JLabel platformImage = new JLabel();
    platformImage.setIcon(resources.getIcon("platform_logo.png"));
    add(platformImage, new GridBagConstraints(0, 0, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(30, 0, 0, 0), 0, 0));
    JLabel instructionText = new JLabel("<html><body align=\"center\">" + resources.getString("login.instructions") + "</body></html>", JLabel.CENTER);
    instructionText.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    instructionText.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    add(instructionText, new GridBagConstraints(0, 1, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(9, 3, 0, 3), 0, 0));
    JLabel userLabel = new JLabel(resources.getString("login.username"));
    userLabel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    userLabel.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    add(userLabel, new GridBagConstraints(0, 2, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(10, 20, 0, 20), 0, 0));
    // Setup username box
    nameSelect = new JComboBox();
    if (System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("mac")) {
        nameSelect.setUI(new MetalComboBoxUI());
    }
    nameSelect.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    nameSelect.setEditable(true);
    nameSelect.setBorder(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 10));
    nameSelect.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    nameSelect.setBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    nameSelect.setVisible(false);
    UserCellRenderer userRenderer = new UserCellRenderer(resources, this.skinRepository);
    userRenderer.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    userRenderer.setSelectedBackgroundColor(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    userRenderer.setSelectedForegroundColor(LauncherFrame.COLOR_BUTTON_BLUE);
    userRenderer.setUnselectedBackgroundColor(LauncherFrame.COLOR_CENTRAL_BACK_OPAQUE);
    userRenderer.setUnselectedForegroundColor(LauncherFrame.COLOR_BUTTON_BLUE);
    nameSelect.setRenderer(userRenderer);
    UserCellEditor userEditor = new UserCellEditor(resources.getFont(ResourceLoader.FONT_OPENSANS, 16), this.skinRepository, LauncherFrame.COLOR_BUTTON_BLUE);
    nameSelect.setEditor(userEditor);
    userEditor.addKeyListener(this);
    nameSelect.setUI(new SimpleButtonComboUI(new RoundedBorderFormatter(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 0)), resources, LauncherFrame.COLOR_SCROLL_TRACK, LauncherFrame.COLOR_SCROLL_THUMB));
    nameSelect.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            changeUser();
        }
    });
    add(nameSelect, new GridBagConstraints(0, 3, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(3, 20, 0, 20), 4, 4));
    name = new JTextField();
    name.setBorder(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 10));
    name.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    name.setBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    name.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    name.setCaretColor(LauncherFrame.COLOR_BUTTON_BLUE);
    name.addKeyListener(this);
    add(name, new GridBagConstraints(0, 3, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(3, 20, 0, 20), 4, 17));
    JLabel passLabel = new JLabel(resources.getString("login.password"));
    passLabel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    passLabel.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    add(passLabel, new GridBagConstraints(0, 4, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(12, 20, 0, 20), 0, 0));
    // Setup password box
    password = new JPasswordField();
    password.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    password.setBorder(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 10));
    password.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    password.setBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    password.addKeyListener(this);
    password.setEchoChar('*');
    password.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            attemptLogin();
        }
    });
    password.setCaretColor(LauncherFrame.COLOR_BUTTON_BLUE);
    add(password, new GridBagConstraints(0, 5, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(3, 20, 0, 20), 4, 17));
    // "Remember this account"
    Font rememberFont = resources.getFont(ResourceLoader.FONT_OPENSANS, 14);
    rememberAccount = new JCheckBox("<html><body style=\"color:#D0D0D0\">" + resources.getString("login.remember") + "</body></html>", false);
    rememberAccount.setFont(rememberFont);
    rememberAccount.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    rememberAccount.setOpaque(false);
    rememberAccount.setHorizontalTextPosition(SwingConstants.LEFT);
    rememberAccount.setHorizontalAlignment(SwingConstants.RIGHT);
    rememberAccount.setBorder(BorderFactory.createEmptyBorder());
    rememberAccount.setIconTextGap(6);
    rememberAccount.addKeyListener(this);
    rememberAccount.setSelectedIcon(resources.getIcon("checkbox_closed.png"));
    rememberAccount.setIcon(resources.getIcon("checkbox_open.png"));
    rememberAccount.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            toggleRemember();
        }
    });
    rememberAccount.setFocusPainted(false);
    add(rememberAccount, new GridBagConstraints(1, 6, 2, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(24, 20, 0, 20), 0, 0));
    // Login button
    RoundedButton button = new RoundedButton(resources.getString("login.button"));
    button.setBorder(BorderFactory.createEmptyBorder(5, 17, 10, 17));
    button.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    button.setContentAreaFilled(false);
    button.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    button.setHoverForeground(LauncherFrame.COLOR_BLUE);
    button.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            attemptLogin();
        }
    });
    add(button, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(24, 20, 0, 0), 0, 0));
    add(Box.createVerticalGlue(), new GridBagConstraints(0, 8, 3, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    JPanel linkPane = new JPanel();
    linkPane.setBackground(LauncherFrame.COLOR_SELECTOR_BACK);
    linkPane.setBorder(BorderFactory.createEmptyBorder(7, 0, 7, 0));
    linkPane.setLayout(new BoxLayout(linkPane, BoxLayout.LINE_AXIS));
    linkPane.add(Box.createHorizontalStrut(8));
    languages = new JComboBox();
    String defaultLocaleText = resources.getString("launcheroptions.language.default");
    if (!resources.isDefaultLocaleSupported()) {
        defaultLocaleText = defaultLocaleText.concat(" (" + resources.getString("launcheroptions.language.unavailable") + ")");
    }
    languages.addItem(new LanguageItem(ResourceLoader.DEFAULT_LOCALE, defaultLocaleText, resources));
    for (int i = 0; i < LauncherMain.supportedLanguages.length; i++) {
        languages.addItem(new LanguageItem(resources.getCodeFromLocale(LauncherMain.supportedLanguages[i]), LauncherMain.supportedLanguages[i].getDisplayName(LauncherMain.supportedLanguages[i]), resources.getVariant(LauncherMain.supportedLanguages[i])));
    }
    if (!settings.getLanguageCode().equalsIgnoreCase(ResourceLoader.DEFAULT_LOCALE)) {
        Locale loc = resources.getLocaleFromCode(settings.getLanguageCode());
        for (int i = 0; i < LauncherMain.supportedLanguages.length; i++) {
            if (loc.equals(LauncherMain.supportedLanguages[i])) {
                languages.setSelectedIndex(i + 1);
                break;
            }
        }
    }
    languages.setBorder(BorderFactory.createEmptyBorder());
    languages.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 14));
    languages.setUI(new LanguageCellUI(resources, new RoundedBorderFormatter(new LineBorder(Color.black, 1)), LauncherFrame.COLOR_SCROLL_TRACK, LauncherFrame.COLOR_SCROLL_THUMB));
    languages.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    languages.setBackground(LauncherFrame.COLOR_SELECTOR_BACK);
    languages.setRenderer(new LanguageCellRenderer(resources, "globe.png", LauncherFrame.COLOR_SELECTOR_BACK, LauncherFrame.COLOR_WHITE_TEXT));
    languages.setEditable(false);
    languages.setFocusable(false);
    languages.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            languageChanged();
        }
    });
    linkPane.add(languages);
    linkPane.add(Box.createHorizontalGlue());
    JButton termsLink = new JButton(resources.getString("login.terms"));
    termsLink.setContentAreaFilled(false);
    termsLink.setBorder(BorderFactory.createEmptyBorder());
    termsLink.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    termsLink.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 14));
    termsLink.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    termsLink.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            visitTerms();
        }
    });
    linkPane.add(termsLink);
    linkPane.add(Box.createHorizontalStrut(8));
    add(linkPane, new GridBagConstraints(0, 9, 3, 1, 1.0, 0.0, GridBagConstraints.SOUTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
}
Also used : Locale(java.util.Locale) RoundedButton(net.technicpack.ui.controls.RoundedButton) ActionEvent(java.awt.event.ActionEvent) LineBorder(javax.swing.border.LineBorder) LanguageCellRenderer(net.technicpack.ui.controls.lang.LanguageCellRenderer) RoundedBorderFormatter(net.technicpack.ui.controls.list.popupformatters.RoundedBorderFormatter) LanguageCellUI(net.technicpack.ui.controls.lang.LanguageCellUI) MetalComboBoxUI(javax.swing.plaf.metal.MetalComboBoxUI) SimpleButtonComboUI(net.technicpack.ui.controls.list.SimpleButtonComboUI) ActionListener(java.awt.event.ActionListener) RoundBorder(net.technicpack.ui.controls.borders.RoundBorder) LanguageItem(net.technicpack.ui.listitems.LanguageItem)

Example 2 with RoundedBorderFormatter

use of net.technicpack.ui.controls.list.popupformatters.RoundedBorderFormatter in project LauncherV3 by TechnicPack.

the class OptionsDialog method setupJavaOptionsPanel.

private void setupJavaOptionsPanel(JPanel panel) {
    panel.setLayout(new GridBagLayout());
    JLabel versionLabel = new JLabel(resources.getString("launcheroptions.java.version"));
    versionLabel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    versionLabel.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    panel.add(versionLabel, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 60, 0, 0), 0, 0));
    versionSelect = new JComboBox();
    if (System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("mac")) {
        versionSelect.setUI(new MetalComboBoxUI());
    }
    versionSelect.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    versionSelect.setEditable(false);
    versionSelect.setBorder(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 10));
    versionSelect.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    versionSelect.setBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    SimpleButtonComboUI ui = new SimpleButtonComboUI(new RoundedBorderFormatter(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 0)), resources, LauncherFrame.COLOR_SCROLL_TRACK, LauncherFrame.COLOR_SCROLL_THUMB);
    versionSelect.setUI(ui);
    versionSelect.setFocusable(false);
    Object child = versionSelect.getAccessibleContext().getAccessibleChild(0);
    BasicComboPopup popup = (BasicComboPopup) child;
    JList list = popup.getList();
    list.setSelectionForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    list.setSelectionBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    list.setBackground(LauncherFrame.COLOR_CENTRAL_BACK_OPAQUE);
    panel.add(versionSelect, new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(8, 16, 8, 8), 0, 16));
    RoundedButton otherVersionButton = new RoundedButton(resources.getString("launcheroptions.java.otherversion"));
    otherVersionButton.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    otherVersionButton.setContentAreaFilled(false);
    otherVersionButton.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    otherVersionButton.setHoverForeground(LauncherFrame.COLOR_BLUE);
    otherVersionButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            selectOtherVersion();
        }
    });
    panel.add(otherVersionButton, new GridBagConstraints(2, 0, 5, 1, 2, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(8, 8, 8, 80), 0, 0));
    JLabel memLabel = new JLabel(resources.getString("launcheroptions.java.memory"));
    memLabel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    memLabel.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    panel.add(memLabel, new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 60, 0, 0), 0, 0));
    memSelect = new JComboBox();
    if (System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("mac")) {
        memSelect.setUI(new MetalComboBoxUI());
    }
    memSelect.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    memSelect.setEditable(false);
    memSelect.setBorder(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 10));
    memSelect.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    memSelect.setBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    ui = new SimpleButtonComboUI(new RoundedBorderFormatter(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 0)), resources, LauncherFrame.COLOR_SCROLL_TRACK, LauncherFrame.COLOR_SCROLL_THUMB);
    memSelect.setUI(ui);
    memSelect.setFocusable(false);
    child = memSelect.getAccessibleContext().getAccessibleChild(0);
    popup = (BasicComboPopup) child;
    list = popup.getList();
    list.setSelectionForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    list.setSelectionBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    list.setBackground(LauncherFrame.COLOR_CENTRAL_BACK_OPAQUE);
    panel.add(memSelect, new GridBagConstraints(1, 1, 6, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(8, 16, 8, 80), 0, 16));
    JLabel argsLabel = new JLabel(resources.getString("launcheroptions.java.arguments"));
    argsLabel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    argsLabel.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    panel.add(argsLabel, new GridBagConstraints(0, 2, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 60, 0, 0), 0, 0));
    javaArgs = new JTextArea(32, 4);
    javaArgs.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    javaArgs.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    javaArgs.setBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    javaArgs.setBorder(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 8));
    javaArgs.setCaretColor(LauncherFrame.COLOR_BUTTON_BLUE);
    javaArgs.setMargin(new Insets(16, 4, 16, 4));
    javaArgs.setLineWrap(true);
    javaArgs.setWrapStyleWord(true);
    javaArgs.setSelectionColor(LauncherFrame.COLOR_BUTTON_BLUE);
    javaArgs.setSelectedTextColor(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    panel.add(javaArgs, new GridBagConstraints(1, 2, 6, 2, 0, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(8, 16, 6, 80), 0, 0));
    JLabel autoApprovalLabel = new JLabel(resources.getString("launcheroptions.java.autoApprove"));
    autoApprovalLabel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    autoApprovalLabel.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    panel.add(autoApprovalLabel, new GridBagConstraints(0, 4, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 20, 0, 0), 0, 0));
    askFirstBox = new JCheckBox("", false);
    askFirstBox.setOpaque(false);
    askFirstBox.setHorizontalAlignment(SwingConstants.RIGHT);
    askFirstBox.setBorder(BorderFactory.createEmptyBorder());
    askFirstBox.setIconTextGap(0);
    askFirstBox.setSelectedIcon(resources.getIcon("checkbox_closed.png"));
    askFirstBox.setIcon(resources.getIcon("checkbox_open.png"));
    askFirstBox.setFocusPainted(false);
    panel.add(askFirstBox, new GridBagConstraints(1, 4, 6, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(8, 16, 8, 8), 0, 0));
    panel.add(Box.createGlue(), new GridBagConstraints(4, 5, 1, 1, 1, 0.5, 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) MetalComboBoxUI(javax.swing.plaf.metal.MetalComboBoxUI) SimpleButtonComboUI(net.technicpack.ui.controls.list.SimpleButtonComboUI) RoundedBorderFormatter(net.technicpack.ui.controls.list.popupformatters.RoundedBorderFormatter) ActionListener(java.awt.event.ActionListener) RoundBorder(net.technicpack.ui.controls.borders.RoundBorder) BasicComboPopup(javax.swing.plaf.basic.BasicComboPopup)

Example 3 with RoundedBorderFormatter

use of net.technicpack.ui.controls.list.popupformatters.RoundedBorderFormatter in project LauncherV3 by TechnicPack.

the class OptionsDialog method setupVideoOptionsPanel.

private void setupVideoOptionsPanel(JPanel panel) {
    panel.setLayout(new GridBagLayout());
    JLabel streamLabel = new JLabel(resources.getString("launcheroptions.video.windowSize"));
    streamLabel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    streamLabel.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    panel.add(streamLabel, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 40, 0, 0), 0, 0));
    windowSelect = new JComboBox();
    if (System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("mac")) {
        windowSelect.setUI(new MetalComboBoxUI());
    }
    windowSelect.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    windowSelect.setEditable(false);
    windowSelect.setBorder(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 10));
    windowSelect.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    windowSelect.setBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    windowSelect.setUI(new SimpleButtonComboUI(new RoundedBorderFormatter(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 0)), resources, LauncherFrame.COLOR_SCROLL_TRACK, LauncherFrame.COLOR_SCROLL_THUMB));
    windowSelect.setFocusable(false);
    Object child = windowSelect.getAccessibleContext().getAccessibleChild(0);
    BasicComboPopup popup = (BasicComboPopup) child;
    JList list = popup.getList();
    list.setSelectionForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    list.setSelectionBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    list.setBackground(LauncherFrame.COLOR_CENTRAL_BACK_OPAQUE);
    panel.add(windowSelect, new GridBagConstraints(1, 0, 1, 1, 0.5f, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(8, 16, 8, 16), 0, 16));
    JLabel widthLabel = new JLabel(resources.getString("launcheroptions.video.windowSize.width"));
    widthLabel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    widthLabel.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    panel.add(widthLabel, new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    widthInput = new JTextField(3);
    widthInput.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    widthInput.setForeground(LauncherFrame.COLOR_BLUE);
    widthInput.setBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    widthInput.setBorder(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 8));
    widthInput.setCaretColor(LauncherFrame.COLOR_BLUE);
    widthInput.setText("800");
    panel.add(widthInput, new GridBagConstraints(3, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(8, 6, 8, 16), 0, 0));
    JLabel heightLabel = new JLabel(resources.getString("launcheroptions.video.windowSize.height"));
    heightLabel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    heightLabel.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    panel.add(heightLabel, new GridBagConstraints(4, 0, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    heightInput = new JTextField(3);
    heightInput.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    heightInput.setForeground(LauncherFrame.COLOR_BLUE);
    heightInput.setBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    heightInput.setBorder(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 8));
    heightInput.setCaretColor(LauncherFrame.COLOR_BLUE);
    heightInput.setText("600");
    panel.add(heightInput, new GridBagConstraints(5, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(8, 6, 8, 16), 0, 0));
    // Add show console field
    JLabel useStencilField = new JLabel(resources.getString("launcheroptions.video.stencil"));
    useStencilField.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    useStencilField.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    panel.add(useStencilField, new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(10, 40, 0, 0), 0, 0));
    useStencil = new JComboBox();
    if (System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("mac")) {
        useStencil.setUI(new MetalComboBoxUI());
    }
    useStencil.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    useStencil.setEditable(false);
    useStencil.setBorder(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 10));
    useStencil.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    useStencil.setBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    useStencil.setUI(new SimpleButtonComboUI(new RoundedBorderFormatter(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 0)), resources, LauncherFrame.COLOR_SCROLL_TRACK, LauncherFrame.COLOR_SCROLL_THUMB));
    useStencil.setFocusable(false);
    child = useStencil.getAccessibleContext().getAccessibleChild(0);
    popup = (BasicComboPopup) child;
    list = popup.getList();
    list.setSelectionForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    list.setSelectionBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    list.setBackground(LauncherFrame.COLOR_CENTRAL_BACK_OPAQUE);
    panel.add(useStencil, new GridBagConstraints(1, 1, 1, 1, 0.5f, 0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(8, 16, 8, 16), 0, 16));
    JLabel stencilInfo = new JLabel("") {

        @Override
        public Dimension getMaximumSize() {
            return getMinimumSize();
        }

        @Override
        public Dimension getPreferredSize() {
            return getMinimumSize();
        }
    };
    stencilInfo.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 12));
    stencilInfo.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    stencilInfo.setText("<html><body style=\"font-family:" + stencilInfo.getFont().getFamily() + ";color:#D0D0D0\">" + resources.getString("launcheroptions.video.stencil.info") + "</body></html>");
    panel.add(stencilInfo, new GridBagConstraints(2, 1, 4, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    panel.add(Box.createHorizontalStrut(60), new GridBagConstraints(7, 1, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 30, 0));
    panel.add(Box.createGlue(), new GridBagConstraints(0, 2, 8, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
}
Also used : MetalComboBoxUI(javax.swing.plaf.metal.MetalComboBoxUI) SimpleButtonComboUI(net.technicpack.ui.controls.list.SimpleButtonComboUI) RoundedBorderFormatter(net.technicpack.ui.controls.list.popupformatters.RoundedBorderFormatter) RoundBorder(net.technicpack.ui.controls.borders.RoundBorder) BasicComboPopup(javax.swing.plaf.basic.BasicComboPopup)

Example 4 with RoundedBorderFormatter

use of net.technicpack.ui.controls.list.popupformatters.RoundedBorderFormatter in project LauncherV3 by TechnicPack.

the class ModpackOptionsDialog method initComponents.

private void initComponents() {
    setSize(DIALOG_WIDTH, DIALOG_HEIGHT);
    setLayout(new BorderLayout());
    JPanel header = new JPanel();
    header.setBackground(Color.black);
    header.setLayout(new BoxLayout(header, BoxLayout.LINE_AXIS));
    header.setBorder(BorderFactory.createEmptyBorder(4, 8, 4, 8));
    add(header, BorderLayout.PAGE_START);
    JLabel title = new JLabel(resources.getString("launcher.title.modpackoptions"));
    title.setFont(resources.getFont(ResourceLoader.FONT_RALEWAY, 26));
    title.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
    title.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    title.setOpaque(false);
    title.setIcon(resources.getIcon("options_cog.png"));
    header.add(title);
    header.add(Box.createHorizontalGlue());
    JButton closeButton = new JButton();
    closeButton.setIcon(resources.getIcon("close.png"));
    closeButton.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    closeButton.setContentAreaFilled(false);
    closeButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    closeButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            closeDialog();
        }
    });
    closeButton.setFocusPainted(false);
    header.add(closeButton);
    JPanel centerPanel = new JPanel();
    centerPanel.setBackground(LauncherFrame.COLOR_CENTRAL_BACK_OPAQUE);
    centerPanel.setOpaque(true);
    centerPanel.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));
    add(centerPanel, BorderLayout.CENTER);
    centerPanel.setLayout(new GridBagLayout());
    JLabel installFolderLabel = new JLabel(resources.getString("modpackoptions.installfolder.text"));
    installFolderLabel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    installFolderLabel.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    centerPanel.add(installFolderLabel, new GridBagConstraints(0, 0, 3, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    installField = new JTextField("");
    installField.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    installField.setForeground(LauncherFrame.COLOR_BLUE);
    installField.setBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    installField.setHighlighter(null);
    installField.setEditable(false);
    installField.setCursor(null);
    installField.setBorder(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 8));
    centerPanel.add(installField, new GridBagConstraints(3, 0, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 5, 0, 5), 0, 0));
    RoundedButton openFolder = new RoundedButton(resources.getString("modpackoptions.installfolder.open"));
    openFolder.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    openFolder.setContentAreaFilled(false);
    openFolder.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    openFolder.setHoverForeground(LauncherFrame.COLOR_BLUE);
    openFolder.setEnabled(modpack.getInstalledDirectory() != null && modpack.getInstalledDirectory().exists());
    if (modpack.getInstalledDirectory() != null && modpack.getInstalledDirectory().exists()) {
        openFolder.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
        openFolder.setHoverForeground(LauncherFrame.COLOR_BLUE);
    } else {
        openFolder.setForeground(LauncherFrame.COLOR_GREY_TEXT);
    }
    openFolder.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            openFolder();
        }
    });
    centerPanel.add(openFolder, new GridBagConstraints(4, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 5, 0, 5), 0, 0));
    RoundedButton moveFolder = new RoundedButton(resources.getString("modpackoptions.installfolder.move"));
    moveFolder.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    moveFolder.setContentAreaFilled(false);
    moveFolder.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    moveFolder.setHoverForeground(LauncherFrame.COLOR_BLUE);
    moveFolder.setEnabled(modpack.getInstalledDirectory() != null && modpack.getInstalledDirectory().exists());
    if (modpack.getInstalledDirectory() != null && modpack.getInstalledDirectory().exists()) {
        moveFolder.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
        moveFolder.setHoverForeground(LauncherFrame.COLOR_BLUE);
    } else {
        moveFolder.setForeground(LauncherFrame.COLOR_GREY_TEXT);
    }
    moveFolder.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            moveFolder();
        }
    });
    centerPanel.add(moveFolder, new GridBagConstraints(5, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0));
    centerPanel.add(Box.createVerticalStrut(15), new GridBagConstraints(0, 1, 6, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    JLabel buildSelectLabel = new JLabel(resources.getString("modpackoptions.version.text"));
    buildSelectLabel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    buildSelectLabel.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    centerPanel.add(buildSelectLabel, new GridBagConstraints(0, 2, 6, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0));
    recommended = new JRadioButton(resources.getString("modpackoptions.version.recommended"));
    recommended.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    recommended.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    recommended.setIcon(resources.getIcon("radio_deselected.png"));
    recommended.setSelectedIcon(resources.getIcon("radio_selected.png"));
    recommended.setFocusPainted(false);
    recommended.setOpaque(false);
    recommended.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            selectRecommended();
        }
    });
    centerPanel.add(recommended, new GridBagConstraints(1, 3, 5, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0));
    latest = new JRadioButton(resources.getString("modpackoptions.version.latest"));
    latest.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    latest.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    latest.setIcon(resources.getIcon("radio_deselected.png"));
    latest.setSelectedIcon(resources.getIcon("radio_selected.png"));
    latest.setFocusPainted(false);
    latest.setOpaque(false);
    latest.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            selectLatest();
        }
    });
    centerPanel.add(latest, new GridBagConstraints(1, 4, 5, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0));
    manual = new JRadioButton(resources.getString("modpackoptions.version.manual"));
    manual.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    manual.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    manual.setIcon(resources.getIcon("radio_deselected.png"));
    manual.setSelectedIcon(resources.getIcon("radio_selected.png"));
    manual.setFocusPainted(false);
    manual.setOpaque(false);
    manual.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            selectManual();
        }
    });
    centerPanel.add(manual, new GridBagConstraints(1, 5, 5, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0));
    ButtonGroup versionType = new ButtonGroup();
    versionType.add(recommended);
    versionType.add(latest);
    versionType.add(manual);
    centerPanel.add(Box.createHorizontalStrut(20), new GridBagConstraints(0, 6, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    centerPanel.add(Box.createHorizontalStrut(20), new GridBagConstraints(1, 6, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    manualBuildList = new JComboBox();
    if (System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("mac")) {
        manualBuildList.setUI(new MetalComboBoxUI());
    }
    AdvancedCellRenderer renderer = new AdvancedCellRenderer();
    renderer.setUnselectedBackgroundColor(LauncherFrame.COLOR_CENTRAL_BACK_OPAQUE);
    renderer.setUnselectedForegroundColor(LauncherFrame.COLOR_BUTTON_BLUE);
    renderer.setSelectedForegroundColor(LauncherFrame.COLOR_BUTTON_BLUE);
    renderer.setSelectedBackgroundColor(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    manualBuildList.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    manualBuildList.setEditable(false);
    manualBuildList.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    manualBuildList.setBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    manualBuildList.setRenderer(renderer);
    manualBuildList.setUI(new SimpleButtonComboUI(new RoundedBorderFormatter(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 0)), resources, LauncherFrame.COLOR_SCROLL_TRACK, LauncherFrame.COLOR_SCROLL_THUMB));
    manualBuildList.setFocusable(false);
    manualBuildList.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            buildUpdated();
        }
    });
    Object child = manualBuildList.getAccessibleContext().getAccessibleChild(0);
    BasicComboPopup popup = (BasicComboPopup) child;
    JList list = popup.getList();
    list.setSelectionForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    list.setSelectionBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    list.setBackground(LauncherFrame.COLOR_CENTRAL_BACK_OPAQUE);
    centerPanel.add(manualBuildList, new GridBagConstraints(2, 6, 4, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(5, 0, 0, 0), 0, 0));
    centerPanel.add(Box.createGlue(), new GridBagConstraints(0, 7, 6, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    JPanel bottomButtons = new JPanel();
    bottomButtons.setOpaque(false);
    bottomButtons.setLayout(new BoxLayout(bottomButtons, BoxLayout.LINE_AXIS));
    RoundedButton deletePack = new RoundedButton(resources.getString("modpackoptions.delete.text"));
    deletePack.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    deletePack.setContentAreaFilled(false);
    if (modpack.getInstalledDirectory() != null) {
        deletePack.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
        deletePack.setHoverForeground(LauncherFrame.COLOR_BLUE);
    } else {
        deletePack.setForeground(LauncherFrame.COLOR_GREY_TEXT);
    }
    deletePack.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            deletePack();
        }
    });
    deletePack.setEnabled(modpack.getInstalledDirectory() != null);
    bottomButtons.add(deletePack);
    bottomButtons.add(Box.createHorizontalGlue());
    RoundedButton resetPack = new RoundedButton(resources.getString("modpackoptions.reinstall.text"));
    resetPack.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    resetPack.setContentAreaFilled(false);
    if (modpack.getInstalledDirectory() != null) {
        resetPack.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
        resetPack.setHoverForeground(LauncherFrame.COLOR_BLUE);
    } else {
        resetPack.setForeground(LauncherFrame.COLOR_GREY_TEXT);
    }
    resetPack.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            resetPack();
        }
    });
    resetPack.setEnabled(modpack.getInstalledDirectory() != null);
    bottomButtons.add(resetPack);
    centerPanel.add(bottomButtons, new GridBagConstraints(0, 8, 6, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
}
Also used : AdvancedCellRenderer(net.technicpack.ui.controls.list.AdvancedCellRenderer) RoundedButton(net.technicpack.ui.controls.RoundedButton) ActionEvent(java.awt.event.ActionEvent) MetalComboBoxUI(javax.swing.plaf.metal.MetalComboBoxUI) SimpleButtonComboUI(net.technicpack.ui.controls.list.SimpleButtonComboUI) ActionListener(java.awt.event.ActionListener) RoundedBorderFormatter(net.technicpack.ui.controls.list.popupformatters.RoundedBorderFormatter) RoundBorder(net.technicpack.ui.controls.borders.RoundBorder) BasicComboPopup(javax.swing.plaf.basic.BasicComboPopup)

Example 5 with RoundedBorderFormatter

use of net.technicpack.ui.controls.list.popupformatters.RoundedBorderFormatter in project LauncherV3 by TechnicPack.

the class OptionsDialog method setupGeneralPanel.

private void setupGeneralPanel(JPanel panel) {
    panel.setLayout(new GridBagLayout());
    JLabel streamLabel = new JLabel(resources.getString("launcheroptions.general.build"));
    streamLabel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    streamLabel.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    panel.add(streamLabel, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 40, 0, 0), 0, 0));
    // Setup stream select box
    streamSelect = new JComboBox();
    if (System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("mac")) {
        streamSelect.setUI(new MetalComboBoxUI());
    }
    streamSelect.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    streamSelect.setEditable(false);
    streamSelect.setBorder(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 10));
    streamSelect.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    streamSelect.setBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    streamSelect.setUI(new SimpleButtonComboUI(new RoundedBorderFormatter(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 0)), resources, LauncherFrame.COLOR_SCROLL_TRACK, LauncherFrame.COLOR_SCROLL_THUMB));
    streamSelect.setFocusable(false);
    Object child = streamSelect.getAccessibleContext().getAccessibleChild(0);
    BasicComboPopup popup = (BasicComboPopup) child;
    JList list = popup.getList();
    list.setSelectionForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    list.setSelectionBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    list.setBackground(LauncherFrame.COLOR_CENTRAL_BACK_OPAQUE);
    panel.add(streamSelect, new GridBagConstraints(1, 0, 2, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(8, 16, 8, 16), 0, 16));
    // Setup language box
    JLabel langLabel = new JLabel(resources.getString("launcheroptions.general.lang"));
    langLabel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    langLabel.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    panel.add(langLabel, new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 40, 0, 0), 0, 0));
    langSelect = new JComboBox();
    if (System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("mac")) {
        langSelect.setUI(new MetalComboBoxUI());
    }
    langSelect.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    langSelect.setEditable(false);
    langSelect.setBorder(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 10));
    langSelect.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    langSelect.setBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    langSelect.setUI(new SimpleButtonComboUI(new RoundedBorderFormatter(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 0)), resources, LauncherFrame.COLOR_SCROLL_TRACK, LauncherFrame.COLOR_SCROLL_THUMB));
    langSelect.setFocusable(false);
    child = langSelect.getAccessibleContext().getAccessibleChild(0);
    popup = (BasicComboPopup) child;
    list = popup.getList();
    list.setSelectionForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    list.setSelectionBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    list.setBackground(LauncherFrame.COLOR_CENTRAL_BACK_OPAQUE);
    panel.add(langSelect, new GridBagConstraints(1, 1, 2, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(8, 16, 8, 16), 0, 16));
    // Setup on pack launch box
    JLabel launchLabel = new JLabel(resources.getString("launcheroptions.general.onlaunch"));
    launchLabel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    launchLabel.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    panel.add(launchLabel, new GridBagConstraints(0, 2, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 40, 0, 0), 0, 0));
    launchSelect = new JComboBox();
    if (System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("mac")) {
        launchSelect.setUI(new MetalComboBoxUI());
    }
    launchSelect.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    launchSelect.setEditable(false);
    launchSelect.setBorder(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 10));
    launchSelect.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    launchSelect.setBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    launchSelect.setUI(new SimpleButtonComboUI(new RoundedBorderFormatter(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 0)), resources, LauncherFrame.COLOR_SCROLL_TRACK, LauncherFrame.COLOR_SCROLL_THUMB));
    launchSelect.setFocusable(false);
    child = launchSelect.getAccessibleContext().getAccessibleChild(0);
    popup = (BasicComboPopup) child;
    list = popup.getList();
    list.setSelectionForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    list.setSelectionBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    list.setBackground(LauncherFrame.COLOR_CENTRAL_BACK_OPAQUE);
    panel.add(launchSelect, new GridBagConstraints(1, 2, 2, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(8, 16, 8, 16), 0, 16));
    // Install folder field
    JLabel installLabel = new JLabel(resources.getString("launcheroptions.general.install"));
    installLabel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    installLabel.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    panel.add(installLabel, new GridBagConstraints(0, 3, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 40, 0, 0), 0, 0));
    installField = new JTextField("");
    installField.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    installField.setForeground(LauncherFrame.COLOR_BLUE);
    installField.setBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    installField.setHighlighter(null);
    installField.setEditable(false);
    installField.setCursor(null);
    installField.setBorder(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 8));
    panel.add(installField, new GridBagConstraints(1, 3, 2, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(8, 16, 8, 16), 0, 16));
    RoundedButton reinstallButton = new RoundedButton(resources.getString("launcheroptions.install.change"));
    reinstallButton.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    reinstallButton.setContentAreaFilled(false);
    reinstallButton.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    reinstallButton.setHoverForeground(LauncherFrame.COLOR_BLUE);
    reinstallButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            reinstall();
        }
    });
    panel.add(reinstallButton, new GridBagConstraints(3, 3, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(8, 0, 8, 0), 0, 0));
    // Client ID field
    JLabel clientIdField = new JLabel(resources.getString("launcheroptions.general.id"));
    clientIdField.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    clientIdField.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    panel.add(clientIdField, new GridBagConstraints(0, 4, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 40, 0, 0), 0, 0));
    clientId = new JTextField("abc123");
    clientId.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    clientId.setForeground(LauncherFrame.COLOR_BLUE);
    clientId.setBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    clientId.setHighlighter(null);
    clientId.setEditable(false);
    clientId.setCursor(null);
    clientId.setBorder(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 8));
    panel.add(clientId, new GridBagConstraints(1, 4, 2, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(8, 16, 8, 16), 0, 16));
    RoundedButton copyButton = new RoundedButton(resources.getString("launcheroptions.id.copy"));
    copyButton.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    copyButton.setContentAreaFilled(false);
    copyButton.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    copyButton.setHoverForeground(LauncherFrame.COLOR_BLUE);
    copyButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            copyCid();
        }
    });
    panel.add(copyButton, new GridBagConstraints(3, 4, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(8, 0, 8, 0), 0, 0));
    panel.add(Box.createRigidArea(new Dimension(60, 0)), new GridBagConstraints(4, 3, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    // Add show console field
    JLabel showConsoleField = new JLabel(resources.getString("launcheroptions.general.console"));
    showConsoleField.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    showConsoleField.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    panel.add(showConsoleField, new GridBagConstraints(0, 5, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(10, 40, 0, 0), 0, 0));
    showConsole = new JCheckBox("", false);
    showConsole.setOpaque(false);
    showConsole.setHorizontalAlignment(SwingConstants.RIGHT);
    showConsole.setBorder(BorderFactory.createEmptyBorder());
    showConsole.setIconTextGap(0);
    showConsole.setSelectedIcon(resources.getIcon("checkbox_closed.png"));
    showConsole.setIcon(resources.getIcon("checkbox_open.png"));
    showConsole.setFocusPainted(false);
    panel.add(showConsole, new GridBagConstraints(1, 5, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(16, 16, 0, 0), 0, 0));
    // Add launch to modpacks
    JLabel launchToModpacksField = new JLabel(resources.getString("launcheroptions.general.modpacktab"));
    launchToModpacksField.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    launchToModpacksField.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    panel.add(launchToModpacksField, new GridBagConstraints(0, 6, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(10, 40, 0, 0), 0, 0));
    launchToModpacks = new JCheckBox("", false);
    launchToModpacks.setOpaque(false);
    launchToModpacks.setHorizontalAlignment(SwingConstants.RIGHT);
    launchToModpacks.setBorder(BorderFactory.createEmptyBorder());
    launchToModpacks.setIconTextGap(0);
    launchToModpacks.setSelectedIcon(resources.getIcon("checkbox_closed.png"));
    launchToModpacks.setIcon(resources.getIcon("checkbox_open.png"));
    launchToModpacks.setFocusPainted(false);
    panel.add(launchToModpacks, new GridBagConstraints(1, 6, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(16, 16, 0, 0), 0, 0));
    panel.add(Box.createGlue(), new GridBagConstraints(0, 7, 5, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    // Open logs button
    RoundedButton openLogs = new RoundedButton(resources.getString("launcheroptions.general.logs"));
    openLogs.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    openLogs.setContentAreaFilled(false);
    openLogs.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    openLogs.setHoverForeground(LauncherFrame.COLOR_BLUE);
    openLogs.setBorder(BorderFactory.createEmptyBorder(5, 17, 10, 17));
    openLogs.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            openLogs();
        }
    });
    panel.add(openLogs, new GridBagConstraints(0, 8, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 10, 10, 0), 0, 0));
}
Also used : RoundedButton(net.technicpack.ui.controls.RoundedButton) ActionEvent(java.awt.event.ActionEvent) MetalComboBoxUI(javax.swing.plaf.metal.MetalComboBoxUI) SimpleButtonComboUI(net.technicpack.ui.controls.list.SimpleButtonComboUI) RoundedBorderFormatter(net.technicpack.ui.controls.list.popupformatters.RoundedBorderFormatter) ActionListener(java.awt.event.ActionListener) RoundBorder(net.technicpack.ui.controls.borders.RoundBorder) BasicComboPopup(javax.swing.plaf.basic.BasicComboPopup)

Aggregations

RoundBorder (net.technicpack.ui.controls.borders.RoundBorder)7 RoundedBorderFormatter (net.technicpack.ui.controls.list.popupformatters.RoundedBorderFormatter)7 ActionEvent (java.awt.event.ActionEvent)6 ActionListener (java.awt.event.ActionListener)6 RoundedButton (net.technicpack.ui.controls.RoundedButton)6 MetalComboBoxUI (javax.swing.plaf.metal.MetalComboBoxUI)5 SimpleButtonComboUI (net.technicpack.ui.controls.list.SimpleButtonComboUI)5 BasicComboPopup (javax.swing.plaf.basic.BasicComboPopup)4 Locale (java.util.Locale)3 LineBorder (javax.swing.border.LineBorder)3 LanguageCellRenderer (net.technicpack.ui.controls.lang.LanguageCellRenderer)3 LanguageCellUI (net.technicpack.ui.controls.lang.LanguageCellUI)3 LanguageItem (net.technicpack.ui.listitems.LanguageItem)3 AdvancedCellRenderer (net.technicpack.ui.controls.list.AdvancedCellRenderer)1