SlideShare a Scribd company logo
1 of 4
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class login extends JFrame
{
// Variables declaration
private JLabel jLabel1;
private JLabel jLabel2;
private JTextField jTextField1;
private JPasswordField jPasswordField1;
private JButton jButton1;
private JPanel contentPane;
// End of variables declaration
public login()
{
super();
create();
this.setVisible(true);
}
private void create()
{
jLabel1 = new JLabel();
jLabel2 = new JLabel();
jTextField1 = new JTextField();
jPasswordField1 = new JPasswordField();
jButton1 = new JButton();
contentPane = (JPanel)this.getContentPane();
//
// jLabel1
//
jLabel1.setHorizontalAlignment(SwingConstants.LEFT);
jLabel1.setForeground(new Color(0, 0, 255));
jLabel1.setText("username:");
//
// jLabel2
//
jLabel2.setHorizontalAlignment(SwingConstants.LEFT);
jLabel2.setForeground(new Color(0, 0, 255));
jLabel2.setText("password:");
//
// jTextField1
//
jTextField1.setForeground(new Color(0, 0, 255));
jTextField1.setSelectedTextColor(new Color(0, 0, 255));
jTextField1.setToolTipText("Enter your username");
jTextField1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
jTextField1_actionPerformed(e);
}
});
//
// jPasswordField1
//
jPasswordField1.setForeground(new Color(0, 0, 255));
jPasswordField1.setToolTipText("Enter your password");
jPasswordField1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
jPasswordField1_actionPerformed(e);
}
});
//
// jButton1
//
jButton1.setBackground(new Color(204, 204, 204));
jButton1.setForeground(new Color(0, 0, 255));
jButton1.setText("Login");
jButton1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
jButton1_actionPerformed(e);
}
});
//
// contentPane
//
contentPane.setLayout(null);
contentPane.setBorder(BorderFactory.createEtchedBorder());
contentPane.setBackground(new Color(204, 204, 204));
addComponent(contentPane, jLabel1, 5,10,106,18);
addComponent(contentPane, jLabel2, 5,47,97,18);
addComponent(contentPane, jTextField1, 110,10,183,22);
addComponent(contentPane, jPasswordField1, 110,45,183,22);
addComponent(contentPane, jButton1, 150,75,83,28);
//
// login
//
this.setTitle("Login To Members Area");
this.setLocation(new Point(76, 182));
this.setSize(new Dimension(335, 141));
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
this.setResizable(false);
}
/** Add Component Without a Layout Manager (Absolute Positioning) */
private void addComponent(Container container,Component c,int x,int y,int
width,int height)
{
c.setBounds(x,y,width,height);
container.add(c);
}
private void jTextField1_actionPerformed(ActionEvent e)
{
}
private void jPasswordField1_actionPerformed(ActionEvent e)
{
}
private void jButton1_actionPerformed(ActionEvent e)
{
System.out.println("njButton1_actionPerformed(ActionEvent e)
called.");
String username = new String(jTextField1.getText());
String password = new String(jPasswordField1.getText());
if(username.equals("") || password.equals("")) // If password and
username is empty > Do this >>>
{
jButton1.setEnabled(false);
JLabel errorFields = new JLabel("<HTML><FONT COLOR =
Blue>You must enter a username and password to login.</FONT></HTML>");
JOptionPane.showMessageDialog(null,errorFields);
jTextField1.setText("");
jPasswordField1.setText("");
jButton1.setEnabled(true);
this.setVisible(true);
}
else
{
JLabel optionLabel = new JLabel("<HTML><FONT COLOR = Blue>You
entered</FONT><FONT COLOR = RED> <B>"+username+"</B></FONT> <FONT COLOR =
Blue>as your username.<BR> Is this correct?</FONT></HTML>");
int confirm =JOptionPane.showConfirmDialog(null,optionLabel);
switch(confirm){ // Switch > Case
case JOptionPane.YES_OPTION: // Attempt to Login user
jButton1.setEnabled(false); // Set button enable to false to
prevent 2 login attempts
break;
case JOptionPane.NO_OPTION: // No Case.(Go back. Set text to
0)
jButton1.setEnabled(false);
jTextField1.setText("");
jPasswordField1.setText("");
jButton1.setEnabled(true);
break;
case JOptionPane.CANCEL_OPTION: // Cancel Case.(Go back. Set
text to 0)
jButton1.setEnabled(false);
jTextField1.setText("");
jPasswordField1.setText("");
jButton1.setEnabled(true);
break;
} // End Switch > Case
}
}
public static void main(String[] args)
{
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
try
{
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
}
catch (Exception ex)
{
System.out.println("Failed loading L&F: ");
System.out.println(ex);
}
new login();
};
}

More Related Content

Viewers also liked

MINDSET Untuk Bisa Win Menghadapi Market
MINDSET Untuk Bisa Win Menghadapi MarketMINDSET Untuk Bisa Win Menghadapi Market
MINDSET Untuk Bisa Win Menghadapi Markethttp://www.GoRezeki.com
 
Tips Smart Trade Di Forex Biar Resiko Jadi Lebih Kecil!
Tips Smart Trade Di Forex Biar Resiko Jadi Lebih Kecil!Tips Smart Trade Di Forex Biar Resiko Jadi Lebih Kecil!
Tips Smart Trade Di Forex Biar Resiko Jadi Lebih Kecil!http://www.GoRezeki.com
 
010516 Professional Introduction
010516 Professional Introduction010516 Professional Introduction
010516 Professional IntroductionFrancisco Jimenez
 
010516 Professional Introduction
010516 Professional Introduction010516 Professional Introduction
010516 Professional IntroductionFrancisco Jimenez
 
"Establishment Labs innovates with Q Inside Safety Technology™, insurance pol...
"Establishment Labs innovates with Q Inside Safety Technology™, insurance pol..."Establishment Labs innovates with Q Inside Safety Technology™, insurance pol...
"Establishment Labs innovates with Q Inside Safety Technology™, insurance pol...Motiva Implants Matrix
 
Cara Gila Bebas FINANSIAL Dibawah 90 Hari Lewat Toko Online!
Cara Gila Bebas FINANSIAL Dibawah 90 Hari Lewat Toko Online!Cara Gila Bebas FINANSIAL Dibawah 90 Hari Lewat Toko Online!
Cara Gila Bebas FINANSIAL Dibawah 90 Hari Lewat Toko Online!http://www.GoRezeki.com
 
Tratado entre colombia y panama.p
Tratado entre colombia y panama.pTratado entre colombia y panama.p
Tratado entre colombia y panama.pAnthony Rodriguezz
 
Stamp Auction to be Held on 17th Aug’14 in the UK - TonyLester
Stamp Auction to be Held on 17th Aug’14 in the UK - TonyLesterStamp Auction to be Held on 17th Aug’14 in the UK - TonyLester
Stamp Auction to be Held on 17th Aug’14 in the UK - TonyLesterTony Lester
 
Presentasi BISNIS Onstore - Bisnis TREND Toko Online PRIBADI!..
Presentasi BISNIS Onstore - Bisnis TREND Toko Online PRIBADI!.. Presentasi BISNIS Onstore - Bisnis TREND Toko Online PRIBADI!..
Presentasi BISNIS Onstore - Bisnis TREND Toko Online PRIBADI!.. http://www.GoRezeki.com
 
Bisnis Plan Onstore | Marketing Plan Onstore 2016 | Apa Itu Onstore ?
Bisnis Plan Onstore | Marketing Plan Onstore 2016 | Apa Itu Onstore ?Bisnis Plan Onstore | Marketing Plan Onstore 2016 | Apa Itu Onstore ?
Bisnis Plan Onstore | Marketing Plan Onstore 2016 | Apa Itu Onstore ?http://www.GoRezeki.com
 

Viewers also liked (14)

MINDSET Untuk Bisa Win Menghadapi Market
MINDSET Untuk Bisa Win Menghadapi MarketMINDSET Untuk Bisa Win Menghadapi Market
MINDSET Untuk Bisa Win Menghadapi Market
 
Tips Smart Trade Di Forex Biar Resiko Jadi Lebih Kecil!
Tips Smart Trade Di Forex Biar Resiko Jadi Lebih Kecil!Tips Smart Trade Di Forex Biar Resiko Jadi Lebih Kecil!
Tips Smart Trade Di Forex Biar Resiko Jadi Lebih Kecil!
 
Legalitas Promonesia D4F Indonesia
Legalitas Promonesia D4F IndonesiaLegalitas Promonesia D4F Indonesia
Legalitas Promonesia D4F Indonesia
 
010516 Professional Introduction
010516 Professional Introduction010516 Professional Introduction
010516 Professional Introduction
 
010516 Professional Introduction
010516 Professional Introduction010516 Professional Introduction
010516 Professional Introduction
 
EL COLOR Colorslideshare
EL COLOR ColorslideshareEL COLOR Colorslideshare
EL COLOR Colorslideshare
 
"Establishment Labs innovates with Q Inside Safety Technology™, insurance pol...
"Establishment Labs innovates with Q Inside Safety Technology™, insurance pol..."Establishment Labs innovates with Q Inside Safety Technology™, insurance pol...
"Establishment Labs innovates with Q Inside Safety Technology™, insurance pol...
 
Decomposing Poverty Change: Within- and Between-group Effects
Decomposing Poverty Change: Within- and Between-group Effects Decomposing Poverty Change: Within- and Between-group Effects
Decomposing Poverty Change: Within- and Between-group Effects
 
Cara Gila Bebas FINANSIAL Dibawah 90 Hari Lewat Toko Online!
Cara Gila Bebas FINANSIAL Dibawah 90 Hari Lewat Toko Online!Cara Gila Bebas FINANSIAL Dibawah 90 Hari Lewat Toko Online!
Cara Gila Bebas FINANSIAL Dibawah 90 Hari Lewat Toko Online!
 
Tratado entre colombia y panama.p
Tratado entre colombia y panama.pTratado entre colombia y panama.p
Tratado entre colombia y panama.p
 
Stamp Auction to be Held on 17th Aug’14 in the UK - TonyLester
Stamp Auction to be Held on 17th Aug’14 in the UK - TonyLesterStamp Auction to be Held on 17th Aug’14 in the UK - TonyLester
Stamp Auction to be Held on 17th Aug’14 in the UK - TonyLester
 
Sabar & Semakin Kaya
Sabar & Semakin KayaSabar & Semakin Kaya
Sabar & Semakin Kaya
 
Presentasi BISNIS Onstore - Bisnis TREND Toko Online PRIBADI!..
Presentasi BISNIS Onstore - Bisnis TREND Toko Online PRIBADI!.. Presentasi BISNIS Onstore - Bisnis TREND Toko Online PRIBADI!..
Presentasi BISNIS Onstore - Bisnis TREND Toko Online PRIBADI!..
 
Bisnis Plan Onstore | Marketing Plan Onstore 2016 | Apa Itu Onstore ?
Bisnis Plan Onstore | Marketing Plan Onstore 2016 | Apa Itu Onstore ?Bisnis Plan Onstore | Marketing Plan Onstore 2016 | Apa Itu Onstore ?
Bisnis Plan Onstore | Marketing Plan Onstore 2016 | Apa Itu Onstore ?
 

Similar to Class login

ANSimport java.awt.event.;import javax.swing.; import java..pdf
ANSimport java.awt.event.;import javax.swing.; import java..pdfANSimport java.awt.event.;import javax.swing.; import java..pdf
ANSimport java.awt.event.;import javax.swing.; import java..pdfanupambedcovers
 
program for JRiddle.javapackage riddle;import javax.swing.; i.pdf
program for JRiddle.javapackage riddle;import javax.swing.; i.pdfprogram for JRiddle.javapackage riddle;import javax.swing.; i.pdf
program for JRiddle.javapackage riddle;import javax.swing.; i.pdfannapurnnatextailes
 
JPasswordA.javaimport javax.swing.; import java.awt.; imp.pdf
 JPasswordA.javaimport javax.swing.; import java.awt.; imp.pdf JPasswordA.javaimport javax.swing.; import java.awt.; imp.pdf
JPasswordA.javaimport javax.swing.; import java.awt.; imp.pdfanoopkhandelwal30
 
correct the error import javaxswingJFrame import javaxs.pdf
correct the error import javaxswingJFrame import javaxs.pdfcorrect the error import javaxswingJFrame import javaxs.pdf
correct the error import javaxswingJFrame import javaxs.pdfdevangmittal4
 
20-Arid-850 Ali Haider Cheema BSSE(5A) Evening MPL Assignement 08.docx
20-Arid-850 Ali Haider Cheema BSSE(5A) Evening MPL Assignement 08.docx20-Arid-850 Ali Haider Cheema BSSE(5A) Evening MPL Assignement 08.docx
20-Arid-850 Ali Haider Cheema BSSE(5A) Evening MPL Assignement 08.docxAliHaiderCheema2
 
1.program to use JTextFieldsource codeimport java.awt.;impor.pdf
1.program to use JTextFieldsource codeimport java.awt.;impor.pdf1.program to use JTextFieldsource codeimport java.awt.;impor.pdf
1.program to use JTextFieldsource codeimport java.awt.;impor.pdfaparetail
 
Model-Driven Software Development - Context-Sensitive Transformation
Model-Driven Software Development - Context-Sensitive TransformationModel-Driven Software Development - Context-Sensitive Transformation
Model-Driven Software Development - Context-Sensitive TransformationEelco Visser
 
Nouveau document texte-_-_
Nouveau document texte-_-_Nouveau document texte-_-_
Nouveau document texte-_-_Mohamed Mlika
 
T.Y.B.S.CS Advance Java Practicals Sem 5 Mumbai University
T.Y.B.S.CS Advance Java Practicals Sem 5 Mumbai UniversityT.Y.B.S.CS Advance Java Practicals Sem 5 Mumbai University
T.Y.B.S.CS Advance Java Practicals Sem 5 Mumbai UniversityNiraj Bharambe
 
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdfimport java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdfvenkt12345
 
Tugas Praktikum Java 2
Tugas Praktikum Java 2Tugas Praktikum Java 2
Tugas Praktikum Java 2azmi007
 
correct the error and add code same in the pic import jav.pdf
correct the error and add code same in the pic   import jav.pdfcorrect the error and add code same in the pic   import jav.pdf
correct the error and add code same in the pic import jav.pdfdevangmittal4
 
import javax.swing.; import java.awt.; import java.awt.event..pdf
import javax.swing.; import java.awt.; import java.awt.event..pdfimport javax.swing.; import java.awt.; import java.awt.event..pdf
import javax.swing.; import java.awt.; import java.awt.event..pdfarwholesalelors
 
import javaxswing import javaawtevent import javai.pdf
import javaxswing import javaawtevent import javai.pdfimport javaxswing import javaawtevent import javai.pdf
import javaxswing import javaawtevent import javai.pdfADITIEYEWEAR
 
How do I make my JTable non editableimport java.awt.; import j.pdf
How do I make my JTable non editableimport java.awt.; import j.pdfHow do I make my JTable non editableimport java.awt.; import j.pdf
How do I make my JTable non editableimport java.awt.; import j.pdfforwardcom41
 
Java!!!!!Create a program that authenticates username and password.pdf
Java!!!!!Create a program that authenticates username and password.pdfJava!!!!!Create a program that authenticates username and password.pdf
Java!!!!!Create a program that authenticates username and password.pdfarvindarora20042013
 
Chat application in java using swing and socket programming.
Chat application in java using swing and socket programming.Chat application in java using swing and socket programming.
Chat application in java using swing and socket programming.Kuldeep Jain
 

Similar to Class login (20)

ANSimport java.awt.event.;import javax.swing.; import java..pdf
ANSimport java.awt.event.;import javax.swing.; import java..pdfANSimport java.awt.event.;import javax.swing.; import java..pdf
ANSimport java.awt.event.;import javax.swing.; import java..pdf
 
program for JRiddle.javapackage riddle;import javax.swing.; i.pdf
program for JRiddle.javapackage riddle;import javax.swing.; i.pdfprogram for JRiddle.javapackage riddle;import javax.swing.; i.pdf
program for JRiddle.javapackage riddle;import javax.swing.; i.pdf
 
JPasswordA.javaimport javax.swing.; import java.awt.; imp.pdf
 JPasswordA.javaimport javax.swing.; import java.awt.; imp.pdf JPasswordA.javaimport javax.swing.; import java.awt.; imp.pdf
JPasswordA.javaimport javax.swing.; import java.awt.; imp.pdf
 
correct the error import javaxswingJFrame import javaxs.pdf
correct the error import javaxswingJFrame import javaxs.pdfcorrect the error import javaxswingJFrame import javaxs.pdf
correct the error import javaxswingJFrame import javaxs.pdf
 
20-Arid-850 Ali Haider Cheema BSSE(5A) Evening MPL Assignement 08.docx
20-Arid-850 Ali Haider Cheema BSSE(5A) Evening MPL Assignement 08.docx20-Arid-850 Ali Haider Cheema BSSE(5A) Evening MPL Assignement 08.docx
20-Arid-850 Ali Haider Cheema BSSE(5A) Evening MPL Assignement 08.docx
 
1.program to use JTextFieldsource codeimport java.awt.;impor.pdf
1.program to use JTextFieldsource codeimport java.awt.;impor.pdf1.program to use JTextFieldsource codeimport java.awt.;impor.pdf
1.program to use JTextFieldsource codeimport java.awt.;impor.pdf
 
Model-Driven Software Development - Context-Sensitive Transformation
Model-Driven Software Development - Context-Sensitive TransformationModel-Driven Software Development - Context-Sensitive Transformation
Model-Driven Software Development - Context-Sensitive Transformation
 
Java Assignment Help
Java Assignment HelpJava Assignment Help
Java Assignment Help
 
Nouveau document texte-_-_
Nouveau document texte-_-_Nouveau document texte-_-_
Nouveau document texte-_-_
 
Java Assignment Help
Java Assignment HelpJava Assignment Help
Java Assignment Help
 
T.Y.B.S.CS Advance Java Practicals Sem 5 Mumbai University
T.Y.B.S.CS Advance Java Practicals Sem 5 Mumbai UniversityT.Y.B.S.CS Advance Java Practicals Sem 5 Mumbai University
T.Y.B.S.CS Advance Java Practicals Sem 5 Mumbai University
 
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdfimport java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
 
Tugas Praktikum Java 2
Tugas Praktikum Java 2Tugas Praktikum Java 2
Tugas Praktikum Java 2
 
correct the error and add code same in the pic import jav.pdf
correct the error and add code same in the pic   import jav.pdfcorrect the error and add code same in the pic   import jav.pdf
correct the error and add code same in the pic import jav.pdf
 
To connect two jframe
To connect two jframeTo connect two jframe
To connect two jframe
 
import javax.swing.; import java.awt.; import java.awt.event..pdf
import javax.swing.; import java.awt.; import java.awt.event..pdfimport javax.swing.; import java.awt.; import java.awt.event..pdf
import javax.swing.; import java.awt.; import java.awt.event..pdf
 
import javaxswing import javaawtevent import javai.pdf
import javaxswing import javaawtevent import javai.pdfimport javaxswing import javaawtevent import javai.pdf
import javaxswing import javaawtevent import javai.pdf
 
How do I make my JTable non editableimport java.awt.; import j.pdf
How do I make my JTable non editableimport java.awt.; import j.pdfHow do I make my JTable non editableimport java.awt.; import j.pdf
How do I make my JTable non editableimport java.awt.; import j.pdf
 
Java!!!!!Create a program that authenticates username and password.pdf
Java!!!!!Create a program that authenticates username and password.pdfJava!!!!!Create a program that authenticates username and password.pdf
Java!!!!!Create a program that authenticates username and password.pdf
 
Chat application in java using swing and socket programming.
Chat application in java using swing and socket programming.Chat application in java using swing and socket programming.
Chat application in java using swing and socket programming.
 

Class login

  • 1. import java.awt.*; import java.awt.event.*; import javax.swing.*; public class login extends JFrame { // Variables declaration private JLabel jLabel1; private JLabel jLabel2; private JTextField jTextField1; private JPasswordField jPasswordField1; private JButton jButton1; private JPanel contentPane; // End of variables declaration public login() { super(); create(); this.setVisible(true); } private void create() { jLabel1 = new JLabel(); jLabel2 = new JLabel(); jTextField1 = new JTextField(); jPasswordField1 = new JPasswordField(); jButton1 = new JButton(); contentPane = (JPanel)this.getContentPane(); // // jLabel1 // jLabel1.setHorizontalAlignment(SwingConstants.LEFT); jLabel1.setForeground(new Color(0, 0, 255)); jLabel1.setText("username:"); // // jLabel2 // jLabel2.setHorizontalAlignment(SwingConstants.LEFT); jLabel2.setForeground(new Color(0, 0, 255)); jLabel2.setText("password:"); // // jTextField1 // jTextField1.setForeground(new Color(0, 0, 255)); jTextField1.setSelectedTextColor(new Color(0, 0, 255)); jTextField1.setToolTipText("Enter your username"); jTextField1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jTextField1_actionPerformed(e); } }); // // jPasswordField1 // jPasswordField1.setForeground(new Color(0, 0, 255)); jPasswordField1.setToolTipText("Enter your password");
  • 2. jPasswordField1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jPasswordField1_actionPerformed(e); } }); // // jButton1 // jButton1.setBackground(new Color(204, 204, 204)); jButton1.setForeground(new Color(0, 0, 255)); jButton1.setText("Login"); jButton1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jButton1_actionPerformed(e); } }); // // contentPane // contentPane.setLayout(null); contentPane.setBorder(BorderFactory.createEtchedBorder()); contentPane.setBackground(new Color(204, 204, 204)); addComponent(contentPane, jLabel1, 5,10,106,18); addComponent(contentPane, jLabel2, 5,47,97,18); addComponent(contentPane, jTextField1, 110,10,183,22); addComponent(contentPane, jPasswordField1, 110,45,183,22); addComponent(contentPane, jButton1, 150,75,83,28); // // login // this.setTitle("Login To Members Area"); this.setLocation(new Point(76, 182)); this.setSize(new Dimension(335, 141)); this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); this.setResizable(false); } /** Add Component Without a Layout Manager (Absolute Positioning) */ private void addComponent(Container container,Component c,int x,int y,int width,int height) { c.setBounds(x,y,width,height); container.add(c); } private void jTextField1_actionPerformed(ActionEvent e) { } private void jPasswordField1_actionPerformed(ActionEvent e) { } private void jButton1_actionPerformed(ActionEvent e) { System.out.println("njButton1_actionPerformed(ActionEvent e)
  • 3. called."); String username = new String(jTextField1.getText()); String password = new String(jPasswordField1.getText()); if(username.equals("") || password.equals("")) // If password and username is empty > Do this >>> { jButton1.setEnabled(false); JLabel errorFields = new JLabel("<HTML><FONT COLOR = Blue>You must enter a username and password to login.</FONT></HTML>"); JOptionPane.showMessageDialog(null,errorFields); jTextField1.setText(""); jPasswordField1.setText(""); jButton1.setEnabled(true); this.setVisible(true); } else { JLabel optionLabel = new JLabel("<HTML><FONT COLOR = Blue>You entered</FONT><FONT COLOR = RED> <B>"+username+"</B></FONT> <FONT COLOR = Blue>as your username.<BR> Is this correct?</FONT></HTML>"); int confirm =JOptionPane.showConfirmDialog(null,optionLabel); switch(confirm){ // Switch > Case case JOptionPane.YES_OPTION: // Attempt to Login user jButton1.setEnabled(false); // Set button enable to false to prevent 2 login attempts break; case JOptionPane.NO_OPTION: // No Case.(Go back. Set text to 0) jButton1.setEnabled(false); jTextField1.setText(""); jPasswordField1.setText(""); jButton1.setEnabled(true); break; case JOptionPane.CANCEL_OPTION: // Cancel Case.(Go back. Set text to 0) jButton1.setEnabled(false); jTextField1.setText(""); jPasswordField1.setText(""); jButton1.setEnabled(true); break; } // End Switch > Case } } public static void main(String[] args) { JFrame.setDefaultLookAndFeelDecorated(true); JDialog.setDefaultLookAndFeelDecorated(true); try {