NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

package PoemsFromPensPackage;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class LoginPage extends JFrame implements WindowListener {
private JButton[] button = new JButton[3];
private JPanel[] panel = new JPanel[2];
private JTextField[] textF = new JTextField[2];
public LoginPage() {
Container cp = getContentPane();
cp.setLayout(new GridLayout(2, 1));
panel[0] = new JPanel(new GridLayout(2, 2));
panel[1] = new JPanel(new FlowLayout());
button[0] = new JButton("Login");
LoginAction loginAction = new LoginAction(this);
button[0].addActionListener(loginAction);
button[1] = new JButton("Register");
RegisterAction registerAction = new RegisterAction(this);
button[1].addActionListener(registerAction);
button[2] = new JButton("Forgot Password");
ForgotPasswordAction passwordAction = new ForgotPasswordAction(this);
button[2].addActionListener(passwordAction);
textF[0] = new JTextField("", 26);
textF[1] = new JTextField("", 26);
panel[0].add(new JLabel("Username: "));
panel[0].add(textF[0]);
panel[0].add(new JLabel("Password: "));
panel[0].add(textF[1]);
panel[1].add(button[0]);
panel[1].add(button[1]);
panel[1].add(button[2]);
cp.add(panel[0]);
cp.add(panel[1]);
this.prepareFrame();
}
public void prepareFrame() {
setVisible(true);
setSize(400, 160);
setResizable(false);
setTitle("Poems From Pens - Login Page");
addWindowListener(this);
}
private class LoginAction implements ActionListener {
private LoginPage loginPage;
private boolean usernameFound = false, success = false;

public LoginAction(LoginPage loginPage) {
this.loginPage = loginPage;
}
@Override
public void actionPerformed(ActionEvent e) {
BufferedReader reader = null;
if (!(textF[0].getText().isEmpty() || textF[1].getText().isEmpty())) {
String line = null;
try {
String[] user;
reader = new BufferedReader(new FileReader("users.txt"));
while ((line = reader.readLine()) != null) {
user = line.split(",");
if (user[0].equals(textF[0].getText()) && user[1].equals(textF[1].getText())) {
this.usernameFound = true;
break;
}
}
this.success = this.usernameFound;
}
catch (IOException e1) {
e1.printStackTrace();
}
finally {
try {
if (reader != null) {
reader.close();
}
}
catch (IOException e1) {
e1.printStackTrace();
}
}
if (this.success == true) {
new PFPFrame(textF[0].getText());
loginPage.dispose();
}
else {
System.out.println("Kullanıcı adı veya şifre yanlış.");
}
}
}
}
private class RegisterAction implements ActionListener {
private LoginPage loginPage;
public RegisterAction(LoginPage loginPage) {
this.loginPage = loginPage;
}
public void actionPerformed(ActionEvent evt) {
setVisible(false);
new RegisterPage(loginPage);
}
}
private class ForgotPasswordAction implements ActionListener {
private LoginPage loginPage;
public ForgotPasswordAction(LoginPage loginPage) {
this.loginPage = loginPage;
}
@Override
public void actionPerformed(ActionEvent e) {
setVisible(false);
new ForgotPasswordPage(loginPage);
}
}
@Override
public void windowOpened(WindowEvent e) {
}
@Override
public void windowClosing(WindowEvent e) {
System.exit(0);
}
@Override
public void windowClosed(WindowEvent e) {
}
@Override
public void windowIconified(WindowEvent e) {
}
@Override
public void windowDeiconified(WindowEvent e) {
}
@Override
public void windowActivated(WindowEvent e) {
}
@Override
public void windowDeactivated(WindowEvent e) {
}
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.