mirror of
https://github.com/SKCraft/Launcher.git
synced 2024-11-24 12:16:28 +01:00
Style Account Select dialog (#402)
This commit is contained in:
commit
3a93e9f39a
@ -44,7 +44,7 @@ public class AccountSelectDialog extends JDialog {
|
|||||||
setTitle(SharedLocale.tr("accounts.title"));
|
setTitle(SharedLocale.tr("accounts.title"));
|
||||||
initComponents();
|
initComponents();
|
||||||
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||||
setMinimumSize(new Dimension(350, 170));
|
setMinimumSize(new Dimension(350, 250));
|
||||||
setResizable(false);
|
setResizable(false);
|
||||||
pack();
|
pack();
|
||||||
setLocationRelativeTo(owner);
|
setLocationRelativeTo(owner);
|
||||||
@ -59,37 +59,38 @@ public class AccountSelectDialog extends JDialog {
|
|||||||
accountList.setCellRenderer(new AccountRenderer());
|
accountList.setCellRenderer(new AccountRenderer());
|
||||||
|
|
||||||
JScrollPane accountPane = new JScrollPane(accountList);
|
JScrollPane accountPane = new JScrollPane(accountList);
|
||||||
accountPane.setPreferredSize(new Dimension(250, 100));
|
accountPane.setPreferredSize(new Dimension(280, 150));
|
||||||
accountPane.setAlignmentX(CENTER_ALIGNMENT);
|
accountPane.setAlignmentX(CENTER_ALIGNMENT);
|
||||||
|
|
||||||
loginButton.setFont(loginButton.getFont().deriveFont(Font.BOLD));
|
loginButton.setFont(loginButton.getFont().deriveFont(Font.BOLD));
|
||||||
loginButton.setMargin(new Insets(0, 10, 0, 10));
|
loginButton.setMargin(new Insets(0, 10, 0, 10));
|
||||||
|
|
||||||
|
//Start Buttons
|
||||||
buttonsPanel.setBorder(BorderFactory.createEmptyBorder(26, 13, 13, 13));
|
buttonsPanel.setBorder(BorderFactory.createEmptyBorder(26, 13, 13, 13));
|
||||||
if (launcher.getConfig().isOfflineEnabled()) {
|
if (launcher.getConfig().isOfflineEnabled()) {
|
||||||
buttonsPanel.addElement(offlineButton);
|
buttonsPanel.addElement(offlineButton);
|
||||||
}
|
}
|
||||||
buttonsPanel.addGlue();
|
buttonsPanel.addGlue();
|
||||||
buttonsPanel.addElement(loginButton);
|
|
||||||
buttonsPanel.addElement(cancelButton);
|
buttonsPanel.addElement(cancelButton);
|
||||||
|
buttonsPanel.addElement(loginButton);
|
||||||
|
|
||||||
LinedBoxPanel loginButtonsRow = new LinedBoxPanel(true);
|
//Login Buttons
|
||||||
loginButtonsRow.add(addMojangButton);
|
LinedBoxPanel loginButtonsRow = new LinedBoxPanel(false);
|
||||||
loginButtonsRow.add(addMicrosoftButton);
|
addMojangButton.setAlignmentX(CENTER_ALIGNMENT);
|
||||||
loginButtonsRow.addGlue();
|
addMicrosoftButton.setAlignmentX(CENTER_ALIGNMENT);
|
||||||
loginButtonsRow.add(removeSelected);
|
removeSelected.setAlignmentX(CENTER_ALIGNMENT);
|
||||||
loginButtonsRow.setAlignmentX(CENTER_ALIGNMENT);
|
loginButtonsRow.addElement(addMojangButton);
|
||||||
loginButtonsRow.setBorder(null);
|
loginButtonsRow.addElement(addMicrosoftButton);
|
||||||
|
loginButtonsRow.addElement(removeSelected);
|
||||||
|
loginButtonsRow.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
|
||||||
|
|
||||||
JPanel listPane = new JPanel();
|
JPanel listAndLoginContainer = new JPanel();
|
||||||
listPane.setLayout(new BoxLayout(listPane, BoxLayout.Y_AXIS));
|
listAndLoginContainer.add(accountPane, BorderLayout.WEST);
|
||||||
listPane.add(accountPane);
|
listAndLoginContainer.add(loginButtonsRow, BorderLayout.EAST);
|
||||||
listPane.add(Box.createVerticalStrut(5));
|
listAndLoginContainer.add(Box.createVerticalStrut(5));
|
||||||
listPane.add(loginButtonsRow);
|
listAndLoginContainer.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
|
||||||
listPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
|
|
||||||
listPane.setAlignmentX(CENTER_ALIGNMENT);
|
|
||||||
|
|
||||||
add(listPane, BorderLayout.CENTER);
|
add(listAndLoginContainer, BorderLayout.CENTER);
|
||||||
add(buttonsPanel, BorderLayout.SOUTH);
|
add(buttonsPanel, BorderLayout.SOUTH);
|
||||||
|
|
||||||
loginButton.addActionListener(ev -> attemptExistingLogin(accountList.getSelectedValue()));
|
loginButton.addActionListener(ev -> attemptExistingLogin(accountList.getSelectedValue()));
|
||||||
@ -215,7 +216,7 @@ public class AccountSelectDialog extends JDialog {
|
|||||||
|
|
||||||
private static class AccountRenderer extends JLabel implements ListCellRenderer<SavedSession> {
|
private static class AccountRenderer extends JLabel implements ListCellRenderer<SavedSession> {
|
||||||
public AccountRenderer() {
|
public AccountRenderer() {
|
||||||
setHorizontalAlignment(CENTER);
|
setHorizontalAlignment(LEFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user