mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-02 16:49:10 +00:00
Actually Remove LoginUI Class
This commit is contained in:
@@ -21,6 +21,5 @@ public class Configuration extends org.parabot.api.Configuration {
|
||||
public static final Version BOT_VERSION = ProjectProperties.getProjectVersion();
|
||||
|
||||
public static final String COMMUNITY_PAGE = "https://www.parabot.org/community/";
|
||||
public static final String REGISTRATION_PAGE = COMMUNITY_PAGE + "register/";
|
||||
public static final String BDN_PAGE = "http://bdn.parabot.org/scripts/";
|
||||
}
|
||||
|
||||
@@ -1,157 +0,0 @@
|
||||
package org.parabot.core.ui;
|
||||
|
||||
import org.parabot.core.Configuration;
|
||||
import org.parabot.core.Core;
|
||||
import org.parabot.core.ui.images.Images;
|
||||
import org.parabot.core.ui.utils.SwingUtil;
|
||||
import org.parabot.core.ui.utils.UILog;
|
||||
import org.parabot.environment.input.Keyboard;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Desktop;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPasswordField;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
/**
|
||||
* Users must login with their parabot account through this LoginUI class
|
||||
*
|
||||
* @author Everel
|
||||
*/
|
||||
public class LoginUI extends JFrame {
|
||||
private static final long serialVersionUID = 2032832552863466297L;
|
||||
private static LoginUI instance;
|
||||
|
||||
private JTextField txtUsername;
|
||||
private JPasswordField txtPassword;
|
||||
private JButton cmdLogin;
|
||||
private JButton cmdRegister;
|
||||
|
||||
public LoginUI(String username, String password) {
|
||||
instance = this;
|
||||
attempt(username, password);
|
||||
}
|
||||
|
||||
public LoginUI() {
|
||||
instance = this;
|
||||
|
||||
this.setTitle("Login");
|
||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
this.setLocationByPlatform(true);
|
||||
this.setLayout(new BorderLayout());
|
||||
this.setResizable(false);
|
||||
|
||||
SwingUtil.setParabotIcons(this);
|
||||
|
||||
int w = 250;
|
||||
int x = 8;
|
||||
int y = 64;
|
||||
|
||||
JPanel panel = new JPanel() {
|
||||
private static final long serialVersionUID = 2258761648532714183L;
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
super.paintComponent(g);
|
||||
((Graphics2D) g).setRenderingHint(
|
||||
RenderingHints.KEY_INTERPOLATION,
|
||||
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
|
||||
g.drawImage(Images
|
||||
.getResource("/storage/images/para.png"),
|
||||
0, 8, 250, 45, null);
|
||||
}
|
||||
};
|
||||
panel.setLayout(null);
|
||||
|
||||
txtUsername = new JTextField("");
|
||||
txtUsername.setBounds(x, y, w - (x << 1), 26);
|
||||
txtUsername.addKeyListener(new KeyAdapter() {
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (e.getKeyCode() == KeyEvent.VK_ENTER || e.getKeyCode() == Keyboard.ENTER_KEYCODE) {
|
||||
txtPassword.requestFocus();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
y += 30;
|
||||
|
||||
txtPassword = new JPasswordField("");
|
||||
txtPassword.setBounds(x, y, w - (x << 1), 26);
|
||||
txtPassword.addKeyListener(new KeyAdapter() {
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (e.getKeyCode() == KeyEvent.VK_ENTER || e.getKeyCode() == Keyboard.ENTER_KEYCODE) {
|
||||
attemptLogin();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
y += 30;
|
||||
|
||||
cmdLogin = new JButton("Login");
|
||||
cmdLogin.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
attemptLogin();
|
||||
}
|
||||
});
|
||||
cmdLogin.setBounds(x, y, (w - (x << 1)) / 2 - 8, 24);
|
||||
|
||||
cmdRegister = new JButton("Register");
|
||||
cmdRegister.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
URI uri = URI
|
||||
.create(Configuration.REGISTRATION_PAGE);
|
||||
try {
|
||||
Desktop.getDesktop().browse(uri);
|
||||
} catch (IOException e1) {
|
||||
JOptionPane.showMessageDialog(null, "Connection Error",
|
||||
"Error", JOptionPane.ERROR_MESSAGE);
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
cmdRegister.setBounds(x + (w - (x << 1)) / 2 + 8, y,
|
||||
(w - (x << 1)) / 2 - 8, 24);
|
||||
|
||||
panel.add(txtUsername);
|
||||
panel.add(txtPassword);
|
||||
panel.add(cmdLogin);
|
||||
panel.add(cmdRegister);
|
||||
|
||||
this.add(panel, BorderLayout.CENTER);
|
||||
|
||||
this.setVisible(true);
|
||||
this.requestFocus();
|
||||
|
||||
this.setSize(255, 182);
|
||||
this.setLocationRelativeTo(null);
|
||||
|
||||
}
|
||||
|
||||
public void attemptLogin() {
|
||||
String username = txtUsername.getText();
|
||||
String password = new String(txtPassword.getPassword());
|
||||
|
||||
}
|
||||
|
||||
private void attempt(String user, String pass) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user