Search in sources :

Example 11 with RoundBorder

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

the class OptionsDialog method updateDimensionsEnabled.

private void updateDimensionsEnabled() {
    if (windowSelect.getSelectedIndex() == 2) {
        widthInput.setEnabled(true);
        heightInput.setEnabled(true);
        widthInput.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
        heightInput.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
        widthInput.setBorder(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 8));
        heightInput.setBorder(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 8));
    } else {
        widthInput.setEnabled(false);
        heightInput.setEnabled(false);
        widthInput.setForeground(LauncherFrame.COLOR_GREY_TEXT);
        heightInput.setForeground(LauncherFrame.COLOR_GREY_TEXT);
        widthInput.setBorder(new RoundBorder(LauncherFrame.COLOR_GREY_TEXT, 1, 8));
        heightInput.setBorder(new RoundBorder(LauncherFrame.COLOR_GREY_TEXT, 1, 8));
    }
}
Also used : RoundBorder(net.technicpack.ui.controls.borders.RoundBorder)

Example 12 with RoundBorder

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

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

Example 14 with RoundBorder

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

the class InstallerFrame method setupPortableMode.

private void setupPortableMode(JPanel panel) {
    panel.setLayout(new GridBagLayout());
    JLabel portableSpiel = new JLabel("<html><body align=\"left\" style='margin-right:10px;'>" + resources.getString("launcher.installer.portablespiel") + "</body></html>");
    portableSpiel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    portableSpiel.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    portableSpiel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    panel.add(portableSpiel, new GridBagConstraints(0, 0, 3, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(9, 8, 9, 3), 0, 0));
    panel.add(Box.createGlue(), new GridBagConstraints(0, 1, 3, 1, 1.0, 0.7, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    JLabel installFolderLabel = new JLabel(resources.getString("launcher.installer.folder"));
    installFolderLabel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    installFolderLabel.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    panel.add(installFolderLabel, new GridBagConstraints(0, 2, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 24, 0, 8), 0, 0));
    String installDir = "";
    if (settings.isPortable())
        installDir = settings.getTechnicRoot().getAbsolutePath();
    portableInstallDir = new JTextField(installDir);
    portableInstallDir.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    portableInstallDir.setForeground(LauncherFrame.COLOR_BLUE);
    portableInstallDir.setBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    portableInstallDir.setHighlighter(null);
    portableInstallDir.setEditable(false);
    portableInstallDir.setCursor(null);
    portableInstallDir.setBorder(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 8));
    panel.add(portableInstallDir, new GridBagConstraints(1, 2, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 5, 0, 5), 0, 16));
    RoundedButton selectInstall = new RoundedButton(resources.getString("launcher.installer.select"));
    selectInstall.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    selectInstall.setContentAreaFilled(false);
    selectInstall.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    selectInstall.setHoverForeground(LauncherFrame.COLOR_BLUE);
    selectInstall.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            selectPortable();
        }
    });
    panel.add(selectInstall, new GridBagConstraints(2, 2, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 5, 0, 16), 0, 0));
    panel.add(Box.createGlue(), new GridBagConstraints(0, 3, 3, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    String defaultLocaleText = resources.getString("launcheroptions.language.default");
    if (!resources.isDefaultLocaleSupported()) {
        defaultLocaleText = defaultLocaleText.concat(" (" + resources.getString("launcheroptions.language.unavailable") + ")");
    }
    portableLanguages = new JComboBox();
    portableLanguages.addItem(new LanguageItem(ResourceLoader.DEFAULT_LOCALE, defaultLocaleText, resources));
    for (int i = 0; i < LauncherMain.supportedLanguages.length; i++) {
        portableLanguages.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])) {
                portableLanguages.setSelectedIndex(i + 1);
                break;
            }
        }
    }
    portableLanguages.setBorder(new RoundBorder(LauncherFrame.COLOR_SCROLL_THUMB, 1, 10));
    portableLanguages.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 14));
    portableLanguages.setUI(new LanguageCellUI(resources, new RoundedBorderFormatter(new LineBorder(Color.black, 1)), LauncherFrame.COLOR_SCROLL_TRACK, LauncherFrame.COLOR_SCROLL_THUMB));
    portableLanguages.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    portableLanguages.setBackground(LauncherFrame.COLOR_SELECTOR_BACK);
    portableLanguages.setRenderer(new LanguageCellRenderer(resources, "globe.png", LauncherFrame.COLOR_SELECTOR_BACK, LauncherFrame.COLOR_WHITE_TEXT));
    portableLanguages.setEditable(false);
    portableLanguages.setFocusable(false);
    portableLanguages.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            portableLanguageChanged();
        }
    });
    panel.add(portableLanguages, new GridBagConstraints(0, 4, 1, 0, 0, 0, GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, new Insets(0, 8, 8, 0), 0, 0));
    portableInstallButton = new RoundedButton(resources.getString("launcher.installer.install"));
    portableInstallButton.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    portableInstallButton.setContentAreaFilled(false);
    portableInstallButton.setForeground(LauncherFrame.COLOR_GREY_TEXT);
    portableInstallButton.setHoverForeground(LauncherFrame.COLOR_BLUE);
    portableInstallButton.setBorder(BorderFactory.createEmptyBorder(5, 17, 10, 17));
    portableInstallButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            portableInstall();
        }
    });
    portableInstallButton.setEnabled(false);
    if (!installDir.equals("")) {
        portableInstallButton.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
        portableInstallButton.setEnabled(true);
    }
    panel.add(portableInstallButton, new GridBagConstraints(1, 4, 2, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(0, 0, 8, 8), 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) ActionListener(java.awt.event.ActionListener) LanguageCellUI(net.technicpack.ui.controls.lang.LanguageCellUI) RoundedBorderFormatter(net.technicpack.ui.controls.list.popupformatters.RoundedBorderFormatter) RoundBorder(net.technicpack.ui.controls.borders.RoundBorder) LanguageItem(net.technicpack.ui.listitems.LanguageItem)

Example 15 with RoundBorder

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

the class FixRunDataDialog method addSuccessFailPanel.

private void addSuccessFailPanel(JPanel centerPanel, String fontFamily, int gridBagRow, boolean isSuccess, boolean hasRecommendation, String compareText, String contrastText) {
    JPanel successFailPanel = new JPanel();
    successFailPanel.setBorder(new RoundBorder(getPanelColor(isSuccess, hasRecommendation)));
    successFailPanel.setBackground(getPanelColor(isSuccess, hasRecommendation));
    centerPanel.add(successFailPanel, new GridBagConstraints(0, gridBagRow, 1, 1, 1.0f, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(8, 0, 10, 0), 0, 0));
    successFailPanel.setLayout(new GridBagLayout());
    JLabel checkbox = new JLabel(resourceLoader.getIcon(getPanelIcon(isSuccess, hasRecommendation)));
    successFailPanel.add(checkbox, new GridBagConstraints(0, 0, 1, 2, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 14, 0, 0), 0, 0));
    JLabel label = new JLabel("<html>" + "<body style=\"font-family:" + fontFamily + ";font-size:12px;font-color:#D0D0D0\">" + compareText + "</body>" + "</html>");
    label.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    successFailPanel.add(label, new GridBagConstraints(1, 0, 1, 1, 1.0f, 0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(8, 10, 6, 0), 0, 0));
    label.setPreferredSize(getPreferredSize(label.getText(), DIALOG_WIDTH - 125));
    label = new JLabel("<html>" + "<body style=\"font-family:" + fontFamily + ";font-size:12px;font-color:#D0D0D0\">" + contrastText + "</body>" + "</html>");
    label.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    successFailPanel.add(label, new GridBagConstraints(1, 1, 1, 1, 1.0f, 0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 10, 8, 0), 0, 0));
    label.setPreferredSize(getPreferredSize(label.getText(), DIALOG_WIDTH - 125));
}
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