Search in sources :

Example 1 with RoundBorder

use of net.technicpack.ui.controls.borders.RoundBorder in project LauncherV3 by TechnicPack.

the class ModpackOptionsDialog method selectLatest.

protected void selectLatest() {
    manualBuildList.setBorder(new RoundBorder(LauncherFrame.COLOR_GREY_TEXT, 1, 10));
    manualBuildList.setEnabled(false);
    manualBuildList.setSelectedItem(new PackBuildItem(modpack.getLatestBuild(), resources, modpack));
    this.modpack.setBuild(InstalledPack.LATEST);
}
Also used : PackBuildItem(net.technicpack.launcher.ui.listitems.PackBuildItem) RoundBorder(net.technicpack.ui.controls.borders.RoundBorder)

Example 2 with RoundBorder

use of net.technicpack.ui.controls.borders.RoundBorder in project LauncherV3 by TechnicPack.

the class InstallerFrame method useDefaultDirectoryChanged.

protected void useDefaultDirectoryChanged() {
    if (!standardDefaultDirectory.isSelected()) {
        standardInstallDir.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
        standardInstallDir.setBorder(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 10));
        standardSelectButton.setEnabled(true);
        standardSelectButton.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    } else {
        standardInstallDir.setForeground(LauncherFrame.COLOR_SCROLL_THUMB);
        standardInstallDir.setBorder(new RoundBorder(LauncherFrame.COLOR_SCROLL_THUMB, 1, 10));
        standardSelectButton.setEnabled(false);
        standardSelectButton.setForeground(LauncherFrame.COLOR_GREY_TEXT);
        standardInstallDir.setText(OperatingSystem.getOperatingSystem().getUserDirectoryForApp("technic").getAbsolutePath());
    }
}
Also used : RoundBorder(net.technicpack.ui.controls.borders.RoundBorder)

Example 3 with RoundBorder

use of net.technicpack.ui.controls.borders.RoundBorder in project LauncherV3 by TechnicPack.

the class LoginFrame method setCurrentUser.

protected void setCurrentUser(String user) {
    if (this.name.isVisible())
        this.name.setText(user);
    else
        this.nameSelect.setSelectedItem(user);
    password.setText("");
    password.setEditable(true);
    password.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    password.setBorder(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 10));
    rememberAccount.setSelected(true);
}
Also used : RoundBorder(net.technicpack.ui.controls.borders.RoundBorder)

Example 4 with RoundBorder

use of net.technicpack.ui.controls.borders.RoundBorder 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 5 with RoundBorder

use of net.technicpack.ui.controls.borders.RoundBorder in project LauncherV3 by TechnicPack.

the class LoginFrame method clearCurrentUser.

protected void clearCurrentUser() {
    password.setText("");
    password.setEditable(true);
    password.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    password.setBorder(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 10));
    rememberAccount.setSelected(false);
    name.setText("");
    nameSelect.setSelectedItem("");
}
Also used : RoundBorder(net.technicpack.ui.controls.borders.RoundBorder)

Aggregations

RoundBorder (net.technicpack.ui.controls.borders.RoundBorder)17 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 PackBuildItem (net.technicpack.launcher.ui.listitems.PackBuildItem)3 LanguageCellRenderer (net.technicpack.ui.controls.lang.LanguageCellRenderer)3 LanguageCellUI (net.technicpack.ui.controls.lang.LanguageCellUI)3 LanguageItem (net.technicpack.ui.listitems.LanguageItem)3 DocumentEvent (javax.swing.event.DocumentEvent)1 DocumentListener (javax.swing.event.DocumentListener)1 AbstractDocument (javax.swing.text.AbstractDocument)1 AttributeSet (javax.swing.text.AttributeSet)1 BadLocationException (javax.swing.text.BadLocationException)1 DocumentFilter (javax.swing.text.DocumentFilter)1