profiles: Make it possible to use the enter key on the passward field
This commit is contained in:
@@ -26,6 +26,8 @@ package net.runelite.client.plugins.profiles;
|
|||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
import java.awt.event.FocusEvent;
|
import java.awt.event.FocusEvent;
|
||||||
import java.awt.event.FocusListener;
|
import java.awt.event.FocusListener;
|
||||||
import java.awt.event.KeyAdapter;
|
import java.awt.event.KeyAdapter;
|
||||||
@@ -120,6 +122,9 @@ class ProfilesPanel extends PluginPanel
|
|||||||
txtDecryptPassword.setEchoChar((char) 0);
|
txtDecryptPassword.setEchoChar((char) 0);
|
||||||
txtDecryptPassword.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
|
txtDecryptPassword.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
|
||||||
txtDecryptPassword.setToolTipText(UNLOCK_PASSWORD);
|
txtDecryptPassword.setToolTipText(UNLOCK_PASSWORD);
|
||||||
|
|
||||||
|
txtDecryptPassword.addActionListener(e -> decryptAccounts());
|
||||||
|
|
||||||
txtDecryptPassword.addFocusListener(new FocusListener()
|
txtDecryptPassword.addFocusListener(new FocusListener()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@@ -156,27 +161,7 @@ class ProfilesPanel extends PluginPanel
|
|||||||
@Override
|
@Override
|
||||||
public void mousePressed(MouseEvent e)
|
public void mousePressed(MouseEvent e)
|
||||||
{
|
{
|
||||||
boolean error = false;
|
decryptAccounts();
|
||||||
try
|
|
||||||
{
|
|
||||||
redrawProfiles();
|
|
||||||
}
|
|
||||||
catch (InvalidKeySpecException | NoSuchAlgorithmException | IllegalBlockSizeException | InvalidKeyException | BadPaddingException | NoSuchPaddingException ex)
|
|
||||||
{
|
|
||||||
error = true;
|
|
||||||
showErrorMessage("Unable to load data", "Incorrect password!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (error)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
remove(loginPanel);
|
|
||||||
add(accountPanel, BorderLayout.CENTER);
|
|
||||||
|
|
||||||
profilesPanel.setLayout(new DynamicGridLayout(0, 1, 0, 3));
|
|
||||||
add(profilesPanel, BorderLayout.SOUTH);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -386,6 +371,31 @@ class ProfilesPanel extends PluginPanel
|
|||||||
// addAccounts(config.profilesData());
|
// addAccounts(config.profilesData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void decryptAccounts()
|
||||||
|
{
|
||||||
|
boolean error = false;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
redrawProfiles();
|
||||||
|
}
|
||||||
|
catch (InvalidKeySpecException | NoSuchAlgorithmException | IllegalBlockSizeException | InvalidKeyException | BadPaddingException | NoSuchPaddingException ex)
|
||||||
|
{
|
||||||
|
error = true;
|
||||||
|
showErrorMessage("Unable to load data", "Incorrect password!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
remove(loginPanel);
|
||||||
|
add(accountPanel, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
profilesPanel.setLayout(new DynamicGridLayout(0, 1, 0, 3));
|
||||||
|
add(profilesPanel, BorderLayout.SOUTH);
|
||||||
|
}
|
||||||
|
|
||||||
private void redrawProfiles() throws InvalidKeySpecException, NoSuchAlgorithmException, IllegalBlockSizeException, InvalidKeyException, BadPaddingException, NoSuchPaddingException
|
private void redrawProfiles() throws InvalidKeySpecException, NoSuchAlgorithmException, IllegalBlockSizeException, InvalidKeyException, BadPaddingException, NoSuchPaddingException
|
||||||
{
|
{
|
||||||
profilesPanel.removeAll();
|
profilesPanel.removeAll();
|
||||||
|
|||||||
Reference in New Issue
Block a user