Fixed error message layout in LoginDialog
Updated envoy-common dependency to v0.2-alpha in pom.xml
This commit is contained in:
parent
84fd222956
commit
6e211a01a1
2
pom.xml
2
pom.xml
@ -28,7 +28,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.informatik-ag-ngl</groupId>
|
<groupId>com.github.informatik-ag-ngl</groupId>
|
||||||
<artifactId>envoy-common</artifactId>
|
<artifactId>envoy-common</artifactId>
|
||||||
<version>f~advanced_login-SNAPSHOT</version>
|
<version>v0.2-alpha</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@ -100,19 +100,9 @@ public class LoginDialog extends JDialog {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Listen to handshake rejections
|
// Listen to handshake rejections
|
||||||
EventBus.getInstance().register(HandshakeRejectionEvent.class, evt -> {
|
EventBus.getInstance()
|
||||||
if (errorMessage != null) contentPanel.remove(errorMessage);
|
.register(HandshakeRejectionEvent.class,
|
||||||
clearPasswordFields();
|
evt -> { clearPasswordFields(); errorMessage.setVisible(true); errorMessage.setText(evt.get()); });
|
||||||
errorMessage = new JLabel(evt.get());
|
|
||||||
gbc_errorMessage = new GridBagConstraints();
|
|
||||||
gbc_errorMessage.gridx = 2;
|
|
||||||
gbc_errorMessage.gridy = 0;
|
|
||||||
gbc_errorMessage.fill = GridBagConstraints.HORIZONTAL;
|
|
||||||
gbc_errorMessage.insets = new Insets(5, 5, 5, 5);
|
|
||||||
contentPanel.add(errorMessage, gbc_errorMessage);
|
|
||||||
contentPanel.revalidate();
|
|
||||||
contentPanel.repaint();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Exit the application when the dialog is cancelled
|
// Exit the application when the dialog is cancelled
|
||||||
cancelButton.addActionListener(evt -> { logger.info("The login process has been cancelled. Exiting..."); System.exit(0); });
|
cancelButton.addActionListener(evt -> { logger.info("The login process has been cancelled. Exiting..."); System.exit(0); });
|
||||||
@ -159,6 +149,7 @@ public class LoginDialog extends JDialog {
|
|||||||
private void initUi() {
|
private void initUi() {
|
||||||
setSize(338, 123);
|
setSize(338, 123);
|
||||||
setLocationRelativeTo(null);
|
setLocationRelativeTo(null);
|
||||||
|
setResizable(false);
|
||||||
getContentPane().setLayout(new BorderLayout());
|
getContentPane().setLayout(new BorderLayout());
|
||||||
contentPanel = new JPanel();
|
contentPanel = new JPanel();
|
||||||
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
|
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||||
@ -217,6 +208,16 @@ public class LoginDialog extends JDialog {
|
|||||||
gbc_repeatPasswordField.gridx = 1;
|
gbc_repeatPasswordField.gridx = 1;
|
||||||
gbc_repeatPasswordField.gridy = 2;
|
gbc_repeatPasswordField.gridy = 2;
|
||||||
|
|
||||||
|
errorMessage = new JLabel();
|
||||||
|
gbc_errorMessage = new GridBagConstraints();
|
||||||
|
gbc_errorMessage.gridx = 1;
|
||||||
|
gbc_errorMessage.gridy = 3;
|
||||||
|
gbc_errorMessage.fill = GridBagConstraints.HORIZONTAL;
|
||||||
|
gbc_errorMessage.insets = new Insets(5, 5, 5, 5);
|
||||||
|
errorMessage.setForeground(Color.RED);
|
||||||
|
errorMessage.setVisible(false);
|
||||||
|
contentPanel.add(errorMessage, gbc_errorMessage);
|
||||||
|
|
||||||
buttonPane = new JPanel();
|
buttonPane = new JPanel();
|
||||||
|
|
||||||
registerText = new JTextPane();
|
registerText = new JTextPane();
|
||||||
@ -233,14 +234,14 @@ public class LoginDialog extends JDialog {
|
|||||||
case ItemEvent.SELECTED:
|
case ItemEvent.SELECTED:
|
||||||
contentPanel.add(lblRepeatPassword, gbc_lblRepeatPassword);
|
contentPanel.add(lblRepeatPassword, gbc_lblRepeatPassword);
|
||||||
contentPanel.add(repeatPasswordField, gbc_repeatPasswordField);
|
contentPanel.add(repeatPasswordField, gbc_repeatPasswordField);
|
||||||
setSize(338, 148);
|
setSize(338, 173);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ItemEvent.DESELECTED:
|
case ItemEvent.DESELECTED:
|
||||||
if (repeatPasswordField.getParent() == contentPanel) {
|
if (repeatPasswordField.getParent() == contentPanel) {
|
||||||
contentPanel.remove(lblRepeatPassword);
|
contentPanel.remove(lblRepeatPassword);
|
||||||
contentPanel.remove(repeatPasswordField);
|
contentPanel.remove(repeatPasswordField);
|
||||||
setSize(338, 123);
|
setSize(338, 148);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user