Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 20

CSL-210: Object-Oriented Programming Lab

Semester bce3

GUI PROJECT

FORM 1
package gui_lab;

import javax.swing.JOptionPane;

public class Form1 extends javax.swing.JFrame {

public Form1() {

initComponents();

// lblName.setText("Changed");

// txtName.setText("GUI Text");

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

lblName = new javax.swing.JLabel();

txtName = new javax.swing.JTextField();

btnClick = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

lblName.setBackground(new java.awt.Color(51, 255, 51));

lblName.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N

lblName.setForeground(new java.awt.Color(0, 0, 153));

lblName.setText("Name");

txtName.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N

txtName.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

txtNameActionPerformed(evt);

});

btnClick.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N

CS Department, BUKC Semester Fall 2021


CSL-210: Object-Oriented Programming Lab
CSL-210: Object-Oriented Programming Lab

Semester bce3

btnClick.setForeground(new java.awt.Color(0, 0, 153));

btnClick.setText("CLICK");

btnClick.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

btnClickActionPerformed(evt);

});

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLa

yout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGap(22, 22, 22)

.addComponent(lblName, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(28, 28, 28)

.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, 167, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(layout.createSequentialGroup()

.addGap(149, 149, 149)

.addComponent(btnClick)))

.addContainerGap(65, Short.MAX_VALUE))

);

layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayou

t.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGap(35, 35, 35)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(lblName)

.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(62, 62, 62)

.addComponent(btnClick)

.addContainerGap(144, Short.MAX_VALUE))
CS Department, BUKC Semester Fall 2021
CSL-210: Object-Oriented Programming Lab
CSL-210: Object-Oriented Programming Lab

Semester bce3

);

pack();

}// </editor-fold>

private void txtNameActionPerformed(java.awt.event.ActionEvent evt) {

private void btnClickActionPerformed(java.awt.event.ActionEvent evt) {

String UN=txtName.getText();

if(UN.isEmpty()){

JOptionPane.showMessageDialog(null,"Enter Name please");

// lblName.setText("Btn");

// txtName.setText("Clicked");

public static void main(String args[]) {

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new Form1().setVisible(true);

});

// Variables declaration - do not modify

private javax.swing.JButton btnClick;

private javax.swing.JLabel lblName;

private javax.swing.JTextField txtName;

// End of variables declaration

CS Department, BUKC Semester Fall 2021


CSL-210: Object-Oriented Programming Lab
CSL-210: Object-Oriented Programming Lab

Semester bce3

CS Department, BUKC Semester Fall 2021


CSL-210: Object-Oriented Programming Lab
CSL-210: Object-Oriented Programming Lab

Semester bce3

OHM LAW
package gui_lab;

public class OHM_LAW extends javax.swing.JFrame {

public OHM_LAW() {

initComponents();

btnprint.setEnabled(false);

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

lblOL = new javax.swing.JLabel();

lblf = new javax.swing.JLabel();

jLabel1 = new javax.swing.JLabel();

jLabel2 = new javax.swing.JLabel();

jLabel3 = new javax.swing.JLabel();

txtvolt = new javax.swing.JTextField();

txtohm = new javax.swing.JTextField();

txtamp = new javax.swing.JTextField();

jLabel4 = new javax.swing.JLabel();

jLabel5 = new javax.swing.JLabel();

jLabel6 = new javax.swing.JLabel();

btncalculate = new javax.swing.JButton();

btnclear = new javax.swing.JButton();

btnprint = new javax.swing.JButton();

btnquit = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

lblOL.setFont(new java.awt.Font("Arial Black", 1, 12)); // NOI18N

lblOL.setText("OHM LAW");

lblf.setFont(new java.awt.Font("Arial Black", 1, 14)); // NOI18N

CS Department, BUKC Semester Fall 2021


CSL-210: Object-Oriented Programming Lab
CSL-210: Object-Oriented Programming Lab

Semester bce3

lblf.setText(" I = V/R");

jLabel1.setFont(new java.awt.Font("Arial Black", 0, 18)); // NOI18N

jLabel1.setText(" V:");

jLabel2.setFont(new java.awt.Font("Arial Black", 1, 18)); // NOI18N

jLabel2.setText(" R:");

jLabel3.setFont(new java.awt.Font("Arial Black", 1, 18)); // NOI18N

jLabel3.setText(" I:");

jLabel4.setText("Volts");

jLabel5.setText("Ohm");

jLabel6.setText("Amp");

btncalculate.setText("CALCULATE");

btncalculate.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

btncalculateActionPerformed(evt);

});

btnclear.setText("CLEAR");

btnclear.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

btnclearActionPerformed(evt);

});

btnprint.setText("PRINT");

btnprint.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

CS Department, BUKC Semester Fall 2021


CSL-210: Object-Oriented Programming Lab
CSL-210: Object-Oriented Programming Lab

Semester bce3

btnprintActionPerformed(evt);

});

btnquit.setText("QUIT");

btnquit.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

btnquitActionPerformed(evt);

});

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLa

yout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGap(41, 41, 41)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(lblOL, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)))

.addGroup(layout.createSequentialGroup()

.addGap(61, 61, 61)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

.addComponent(btncalculate, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,


Short.MAX_VALUE)

.addComponent(btnprint, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,


Short.MAX_VALUE)))

.addGroup(layout.createSequentialGroup()

.addGap(30, 30, 30)

.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)))

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGap(41, 41, 41)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

CS Department, BUKC Semester Fall 2021


CSL-210: Object-Oriented Programming Lab
CSL-210: Object-Oriented Programming Lab

Semester bce3

.addComponent(lblf, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

.addComponent(txtamp, javax.swing.GroupLayout.DEFAULT_SIZE, 69, Short.MAX_VALUE)

.addComponent(txtohm))

.addComponent(txtvolt, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(18, 18, 18)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jLabel4)

.addComponent(jLabel5)

.addComponent(jLabel6)))))

.addGroup(layout.createSequentialGroup()

.addGap(83, 83, 83)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

.addComponent(btnquit, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,


Short.MAX_VALUE)

.addComponent(btnclear, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,


Short.MAX_VALUE))))

.addContainerGap(99, Short.MAX_VALUE))

);

layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayou

t.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGap(49, 49, 49)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(lblOL, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(lblf, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGap(21, 21, 21)

.addComponent(jLabel4)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE))

.addGroup(layout.createSequentialGroup()

.addGap(12, 12, 12)

CS Department, BUKC Semester Fall 2021


CSL-210: Object-Oriented Programming Lab
CSL-210: Object-Oriented Programming Lab

Semester bce3

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(txtvolt)

.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)))

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(txtohm, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 28,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel5)))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

.addComponent(txtamp, javax.swing.GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE)

.addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,


Short.MAX_VALUE)))

.addGap(43, 43, 43)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

.addComponent(btncalculate, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,


Short.MAX_VALUE)

.addComponent(btnclear, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

.addGap(11, 11, 11)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(btnprint)

.addComponent(btnquit))

.addContainerGap())

);

pack();

}// </editor-fold>

private void btnquitActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0);

private void btnprintActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

CS Department, BUKC Semester Fall 2021


CSL-210: Object-Oriented Programming Lab
CSL-210: Object-Oriented Programming Lab

Semester bce3

private void btnclearActionPerformed(java.awt.event.ActionEvent evt) {

txtvolt.setText("");

txtohm.setText("");

txtamp.setText("");

private void btncalculateActionPerformed(java.awt.event.ActionEvent evt) {

float Volt= Float.parseFloat(txtvolt.getText());

float Resistance= Float.parseFloat(txtohm.getText());

float Ampere= Volt/Resistance;

txtamp.setText(Float.toString(Ampere));

public static void main(String args[]) {

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new OHM_LAW().setVisible(true);

} }); }

// Variables declaration - do not modify

private javax.swing.JButton btncalculate;

private javax.swing.JButton btnclear;

private javax.swing.JButton btnprint;

private javax.swing.JButton btnquit;

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel3;

private javax.swing.JLabel jLabel4;

private javax.swing.JLabel jLabel5;

private javax.swing.JLabel jLabel6;

private javax.swing.JLabel lblOL;

private javax.swing.JLabel lblf;

private javax.swing.JTextField txtamp;

private javax.swing.JTextField txtohm;

private javax.swing.JTextField txtvolt;

// End of variables declaration }

CS Department, BUKC Semester Fall 2021


CSL-210: Object-Oriented Programming Lab
CSL-210: Object-Oriented Programming Lab

Semester bce3

CS Department, BUKC Semester Fall 2021


CSL-210: Object-Oriented Programming Lab
CSL-210: Object-Oriented Programming Lab

Semester bce3

LOGIN FORM
package gui_lab;

import javax.swing.JOptionPane;

public class LoginForm extends javax.swing.JFrame {

WelcomeForm wel = new WelcomeForm();

public LoginForm() {

initComponents();

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

lbllog = new javax.swing.JLabel();

lblpass = new javax.swing.JLabel();

txtlog = new javax.swing.JTextField();

btnlogin = new javax.swing.JButton();

pwdUP = new javax.swing.JPasswordField();

btnexit = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setUndecorated(true);

lbllog.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

lbllog.setText("Login ID");

lblpass.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

lblpass.setText("Password");

txtlog.setFont(new java.awt.Font("Arial Black", 1, 12)); // NOI18N

btnlogin.setFont(new java.awt.Font("Arial Black", 1, 14)); // NOI18N

btnlogin.setText("LOGIN");

btnlogin.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

CS Department, BUKC Semester Fall 2021


CSL-210: Object-Oriented Programming Lab
CSL-210: Object-Oriented Programming Lab

Semester bce3

btnloginActionPerformed(evt);

});

pwdUP.setFont(new java.awt.Font("Arial Black", 1, 14)); // NOI18N

btnexit.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

btnexit.setText("x");

btnexit.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

btnexitActionPerformed(evt);

});

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLa

yout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

.addComponent(lblpass, javax.swing.GroupLayout.DEFAULT_SIZE, 170, Short.MAX_VALUE)

.addComponent(lbllog, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

.addComponent(pwdUP, javax.swing.GroupLayout.DEFAULT_SIZE, 173, Short.MAX_VALUE)

.addComponent(txtlog))

.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

.addGroup(layout.createSequentialGroup()

.addGap(277, 277, 277)

.addComponent(btnlogin, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)

.addContainerGap(306, Short.MAX_VALUE))

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()

.addGap(0, 0, Short.MAX_VALUE)
CS Department, BUKC Semester Fall 2021
CSL-210: Object-Oriented Programming Lab
CSL-210: Object-Oriented Programming Lab

Semester bce3

.addComponent(btnexit))

);

layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayou

t.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGap(77, 77, 77)

.addComponent(txtlog, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()

.addGap(83, 83, 83)

.addComponent(lbllog, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)))

.addComponent(btnexit))

.addGap(30, 30, 30)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(lblpass, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(pwdUP, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(66, 66, 66)

.addComponent(btnlogin)

.addContainerGap(209, Short.MAX_VALUE))

);

pack();

}// </editor-fold>

private void btnloginActionPerformed(java.awt.event.ActionEvent evt) {

String pwd = String.valueOf(pwdUP.getPassword());

if(txtlog.getText().equals("Eisha Tahir")&& pwd.equals("eis123")){

wel.setVisible(true);

this.setVisible(false);

else{

JOptionPane.showMessageDialog(null,"Login Denied");

txtlog.setText("");

pwdUP.setText("");

CS Department, BUKC Semester Fall 2021


CSL-210: Object-Oriented Programming Lab
CSL-210: Object-Oriented Programming Lab

Semester bce3

private void btnexitActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0);

public static void main(String args[]) {

try {

for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName())) {

javax.swing.UIManager.setLookAndFeel(info.getClassName());

breaK; }

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(LoginForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(LoginForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(LoginForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(LoginForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new LoginForm().setVisible(true); });} // Variables declaration - do not modify

private javax.swing.JButton btnexit;

private javax.swing.JButton btnlogin;

private javax.swing.JLabel lbllog;

private javax.swing.JLabel lblpass;

private javax.swing.JPasswordField pwdUP;

private javax.swing.JTextField txtlog;

// End of variables declaration

CS Department, BUKC Semester Fall 2021


CSL-210: Object-Oriented Programming Lab
CSL-210: Object-Oriented Programming Lab

Semester bce3

WELCOME FORM
package gui_lab;

import javax.swing.JOptionPane;

public class WelcomeForm extends javax.swing.JFrame {

// LoginForm Log = new LoginForm();

public WelcomeForm() {

initComponents();

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

jPanel1 = new javax.swing.JPanel();

jLabel1 = new javax.swing.JLabel();

jButton1 = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setBackground(new java.awt.Color(255, 102, 255));

jPanel1.setBackground(new java.awt.Color(204, 102, 255));

jLabel1.setFont(new java.awt.Font("Tahoma", 3, 18)); // NOI18N

jLabel1.setText(" WELCOME TO NEXT FORM");

javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);

jPanel1.setLayout(jPanel1Layout);

jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.G

roupLayout.Alignment.LEADING)

.addGroup(jPanel1Layout.createSequentialGroup()

.addContainerGap()

.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 453, javax.swing.GroupLayout.PREFERRED_SIZE)

.addContainerGap(169, Short.MAX_VALUE))

);

CS Department, BUKC Semester Fall 2021


CSL-210: Object-Oriented Programming Lab
CSL-210: Object-Oriented Programming Lab

Semester bce3

jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.Gro

upLayout.Alignment.LEADING)

.addGroup(jPanel1Layout.createSequentialGroup()

.addGap(22, 22, 22)

.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)

.addContainerGap(21, Short.MAX_VALUE))

);

jButton1.setFont(new java.awt.Font("Arial Black", 1, 14)); // NOI18N

jButton1.setText("LOGOUT");

jButton1.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton1ActionPerformed(evt);

});

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLa

yout.Alignment.LEADING)

.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()

.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(22, 22, 22))

);

layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayou

t.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addContainerGap()

.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(146, 146, 146)

.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addContainerGap(216, Short.MAX_VALUE))
CS Department, BUKC Semester Fall 2021
CSL-210: Object-Oriented Programming Lab
CSL-210: Object-Oriented Programming Lab

Semester bce3

);

pack();

}// </editor-fold>

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

LoginForm Log = new LoginForm();

Log.setVisible(true);

this.setVisible(false);

public static void main(String args[]) {

//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">

/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.

* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

*/

try {

for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName())) {

javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(WelcomeForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(WelcomeForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(WelcomeForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(WelcomeForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

//</editor-fold>

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

CS Department, BUKC Semester Fall 2021


CSL-210: Object-Oriented Programming Lab
CSL-210: Object-Oriented Programming Lab

Semester bce3

new WelcomeForm().setVisible(true);

});

// Variables declaration - do not modify

private javax.swing.JButton jButton1;

private javax.swing.JLabel jLabel1;

private javax.swing.JPanel jPanel1;

// End of variables declaration

CS Department, BUKC Semester Fall 2021


CSL-210: Object-Oriented Programming Lab
CSL-210: Object-Oriented Programming Lab

Semester bce3

CS Department, BUKC Semester Fall 2021


CSL-210: Object-Oriented Programming Lab

You might also like