Sunteți pe pagina 1din 49

(An ISO 9001:2015 Certified Institution)

(Approved by AICTE, New Delhi & Affiliated to VTU, Belegavi, Karnataka)


181/1, 182/1, Behind SAP Labs, Seetharam Palya, Basavanagar, Hoodi, Bangalore - 560 048

Department of Computer Science and Engineering

Assignment – 3
Object Oriented Concepts / 18CS45

<<Library Management System>>

Submitted by,
Name : Sreerang R
USN : 1GD18CS052
Implementation

/*paste your Code*/

//Login Page
import javax.swing.JOptionPane;
import javax.swing.GroupLayout.Alignment;
import javax.swing.GroupLayout;
import javax.swing.LayoutStyle.ComponentPlacement;
import java.awt.Font;
import javax.swing.JCheckBox;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JLabel;
import javax.swing.JTextArea;
public class LoginPage extends javax.swing.JFrame {
private javax.swing.JLabel Name;
private javax.swing.JLabel Password;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPasswordField pass;
private javax.swing.JTextField user;
private javax.swing.JLabel username;

public LoginPage()
{
initComponents();
}
private void initComponents()
{
Name = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
username = new javax.swing.JLabel();
Password = new javax.swing.JLabel();
user = new javax.swing.JTextField();
pass = new javax.swing.JPasswordField();
pass.setEchoChar('*');
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Login Page");
Name.setFont(new Font("Times New Roman", Font.BOLD, 20)); // NOI18N
Name.setForeground(new java.awt.Color(0, 0, 204));
Name.setText("GOPALAN COLLEGE OF ENGINEERING AND MANAGEMENT");
jLabel2.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N
jLabel2.setText("Library Management System");
jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/2.jpg")));
jLabel3.setText("jLabel3");
username.setText("Username:");
Password.setText("Password;");
jButton1.setText("Submit");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});

JCheckBox chckbxShowPassword = new JCheckBox("Show Password");


chckbxShowPassword.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
if(chckbxShowPassword.isSelected())
pass.setEchoChar((char)0);
else
pass.setEchoChar('*');
}
});

JButton btnCancel = new JButton();


btnCancel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {

System.exit(0);
}
});
btnCancel.setText("Cancel");

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


layout.setHorizontalGroup(
layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap(343, Short.MAX_VALUE)
.addComponent(jLabel3, GroupLayout.PREFERRED_SIZE, 521,
GroupLayout.PREFERRED_SIZE)
.addGap(281))
.addGroup(layout.createSequentialGroup()
.addGap(322)
.addGroup(layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(Name)
.addContainerGap())
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(Alignment.LEADING)
.addComponent(username)
.addComponent(Password))
.addGap(37)

.addGroup(layout.createParallelGroup(Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addComponent(chckbxShowPassword, GroupLayout.DEFAULT_SIZE, 195,


Short.MAX_VALUE)
.addGap(101))

.addGroup(layout.createSequentialGroup()
.addComponent(jButton1,
GroupLayout.PREFERRED_SIZE, 106, GroupLayout.PREFERRED_SIZE)

.addPreferredGap(ComponentPlacement.RELATED)))
.addComponent(btnCancel,
GroupLayout.DEFAULT_SIZE, 89, Short.MAX_VALUE))
.addComponent(pass,
GroupLayout.DEFAULT_SIZE, 385, Short.MAX_VALUE)
.addComponent(user,
GroupLayout.DEFAULT_SIZE, 385, Short.MAX_VALUE))
.addGap(349))))
.addGroup(layout.createSequentialGroup()
.addGap(411)
.addComponent(jLabel2, GroupLayout.DEFAULT_SIZE, 425,
Short.MAX_VALUE)
.addGap(309))
);
layout.setVerticalGroup(
layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel3)
.addGap(35)
.addComponent(Name)
.addGap(18)
.addComponent(jLabel2)
.addGap(39)
.addGroup(layout.createParallelGroup(Alignment.BASELINE)
.addComponent(username)
.addComponent(user, GroupLayout.PREFERRED_SIZE,
GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(18)
.addGroup(layout.createParallelGroup(Alignment.BASELINE)
.addComponent(Password)
.addComponent(pass, GroupLayout.PREFERRED_SIZE,
GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(18)
.addComponent(chckbxShowPassword)
.addGap(18)
.addGroup(layout.createParallelGroup(Alignment.BASELINE)
.addComponent(btnCancel, GroupLayout.DEFAULT_SIZE, 31,
Short.MAX_VALUE)
.addComponent(jButton1, GroupLayout.PREFERRED_SIZE, 32,
GroupLayout.PREFERRED_SIZE))
.addContainerGap(155, Short.MAX_VALUE))
);
getContentPane().setLayout(layout);

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

String un=user.getText();
String p=pass.getText();

if(un.equals("admin") && p.equals("123456")){


MenuPage obj=new MenuPage();
obj.setVisible(true);
dispose();
}
else{
JOptionPane.showMessageDialog(rootPane, "Your Username or password is incorrect");

}
}

public static void main(String args[]) {

java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new LoginPage().setVisible(true);
}
});
}
}
//Menu Page
public class MenuPage extends javax.swing.JFrame {
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;

public MenuPage() {
initComponents();
}

private void initComponents() {

jLabel1 = new javax.swing.JLabel();


jLabel2 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

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


jLabel1.setForeground(new java.awt.Color(0, 0, 204));
jLabel1.setText("Menu Page");

jLabel2.setFont(new java.awt.Font("Times New Roman", 0, 11)); // NOI18N


jLabel2.setForeground(new java.awt.Color(204, 0, 51));
jLabel2.setText("GO BACK");
jLabel2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel2MouseClicked(evt);
}
});
jButton1.setText("Add Students");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});

jButton2.setText("Departments");
jButton2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton2MouseClicked(evt);
}
});

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


getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(286, 286, 286))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addComponent(jLabel2)
.addGap(66, 66, 66))))
.addGroup(layout.createSequentialGroup()
.addGap(68, 68, 68)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 215,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(177, 177, 177)
.addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, 231,
Short.MAX_VALUE)
.addGap(66, 66, 66))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(jLabel2)
.addGap(18, 18, 18)
.addComponent(jLabel1)
.addGap(129, 129, 129)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 57,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 64,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(201, Short.MAX_VALUE))
);

pack();
}

private void jLabel2MouseClicked(java.awt.event.MouseEvent evt) {


LoginPage obj=new LoginPage();
obj.setVisible(true);
dispose();

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

DataEntry obj=new DataEntry();


obj.setVisible(true);
dispose();

private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {


LibDepartment obj=new LibDepartment();
obj.setVisible(true);
dispose();
}

public static void main(String args[]) {

java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new MenuPage().setVisible(true);
}
});
}

}
//Data Entry page
import javax.swing.JOptionPane;

public class DataEntry extends javax.swing.JFrame


{
private javax.swing.JTextField fn;
private javax.swing.JTextField ins;
private javax.swing.JButton jButton1;
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 jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JTextField sem;
private javax.swing.JTextField uid;
private javax.swing.JTextField un;

public DataEntry()
{
initComponents();
}

private void initComponents()


{

jLabel1 = new javax.swing.JLabel();


jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
uid = new javax.swing.JTextField();
ins = new javax.swing.JTextField();
sem = new javax.swing.JTextField();
un = new javax.swing.JTextField();
fn = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jLabel7 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 36)); //


NOI18N
jLabel1.setForeground(new java.awt.Color(51, 0, 255));
jLabel1.setText("DATA ENTRY");
jLabel2.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/36235-200.png"))); //
NOI18N
jLabel2.setText("jLabel2");

jLabel3.setText("User ID:");

jLabel4.setText("Username:");

jLabel5.setText("Father's Name:");

jLabel6.setText("Semester:");

jLabel8.setText("Institute");

jButton1.setText("submitt");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});

jLabel7.setText("GO BACK");
jLabel7.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel7MouseClicked(evt);
}
});

javax.swing.GroupLayout layout = new


javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addGap(171, 171, 171)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEA
DING)
.addComponent(jLabel8)
.addComponent(jLabel6)
.addComponent(jLabel5)
.addComponent(jLabel4)
.addComponent(jLabel3))

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

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEA
DING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addComponent(jLabel2,
javax.swing.GroupLayout.PREFERRED_SIZE, 189,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(216, 216, 216)
.addComponent(jLabel7)
.addGap(62, 62, 62))
.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEA
DING)
.addComponent(uid,
javax.swing.GroupLayout.PREFERRED_SIZE, 223,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ins,
javax.swing.GroupLayout.PREFERRED_SIZE, 223,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(sem,
javax.swing.GroupLayout.PREFERRED_SIZE, 223,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(un,
javax.swing.GroupLayout.PREFERRED_SIZE, 223,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(fn,
javax.swing.GroupLayout.PREFERRED_SIZE, 223,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRA
ILING)
.addComponent(jButton1)
.addComponent(jLabel1))
.addGap(283, 283, 283))))
);
layout.setVerticalGroup(

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

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEA
DING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel2))
.addGroup(layout.createSequentialGroup()
.addGap(22, 22, 22)
.addComponent(jLabel7)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel1)
.addGap(23, 23, 23)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BAS
ELINE)
.addComponent(jLabel3)
.addComponent(uid,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BAS
ELINE)
.addComponent(jLabel4)
.addComponent(un,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(7, 7, 7)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BAS
ELINE)
.addComponent(jLabel5)
.addComponent(fn,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))

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

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BAS
ELINE)
.addComponent(jLabel6)
.addComponent(sem,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BAS
ELINE)
.addComponent(jLabel8)
.addComponent(ins,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 13,
Short.MAX_VALUE)
.addComponent(jButton1)
.addContainerGap())
);

pack();
}// </editor-fold>//GEN-END:initComponents

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


{//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:

String username=un.getText();
String userid=uid.getText();
String father=fn.getText();
String semester=sem.getText();
String institute=ins.getText();

JOptionPane.showMessageDialog(rootPane, "UserID:
"+userid+"\nUsername: "+username+"\nFather's name: "+father+
"\nSemester: "+semester+ "\nInstitute: "+institute+"\n
Data Stored");

}//GEN-LAST:event_jButton1ActionPerformed

private void jLabel7MouseClicked(java.awt.event.MouseEvent evt) {


MenuPage obj=new MenuPage();
obj.setVisible(true);
dispose();

}//GEN-LAST:event_jLabel7MouseClicked

public static void main(String args[]) {

java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new DataEntry().setVisible(true);
}
});
}

}
//Department Page
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.GroupLayout;

public class LibDepartment extends javax.swing.JFrame


{
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 jLabel7;

public LibDepartment()
{

initComponents();
}
private void initComponents()
{

jLabel1 = new javax.swing.JLabel();


jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 36));


jLabel1.setForeground(new java.awt.Color(0, 51, 204));
jLabel1.setText("Library Departments");

jLabel2.setText("Choose the Departments:");

jLabel3.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/3.jfif")));
jLabel3.setText("jLabel3");
jLabel3.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel3MouseClicked(evt);
}
});

jLabel4.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/4.jfif")));
jLabel4.setText("jLabel4");
jLabel4.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel4MouseClicked(evt);
}
});

jLabel5.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/5.jfif")));
jLabel5.setText("jLabel5");
jLabel5.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel5MouseClicked(evt);
}
});

jLabel6.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/6.jfif")));
jLabel6.setText("jLabel6");
jLabel6.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel6MouseClicked(evt);
}
});

jLabel7.setText("Go BACK");
jLabel7.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel7MouseClicked(evt);
}
});

javax.swing.GroupLayout layout = new


javax.swing.GroupLayout(getContentPane());
layout.setHorizontalGroup(
layout.createParallelGroup(Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel2)

.addPreferredGap(ComponentPlacement.RELATED, 575, Short.MAX_VALUE))


.addGroup(Alignment.TRAILING,
layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addGap(190)))
.addComponent(jLabel7)
.addGap(58))
.addGroup(layout.createSequentialGroup()
.addGap(96)

.addGroup(layout.createParallelGroup(Alignment.LEADING)
.addComponent(jLabel5, 0, 0,
Short.MAX_VALUE)
.addComponent(jLabel3,
GroupLayout.PREFERRED_SIZE, 226, GroupLayout.PREFERRED_SIZE))
.addGap(107, 107, Short.MAX_VALUE)

.addGroup(layout.createParallelGroup(Alignment.LEADING)
.addComponent(jLabel6, 0, 0,
Short.MAX_VALUE)
.addComponent(jLabel4, Alignment.TRAILING,
GroupLayout.PREFERRED_SIZE, 227, GroupLayout.PREFERRED_SIZE))
.addContainerGap(153, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(29)

.addGroup(layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(33)
.addComponent(jLabel2))
.addComponent(jLabel7))
.addGap(27)

.addGroup(layout.createParallelGroup(Alignment.BASELINE)
.addComponent(jLabel3,
GroupLayout.PREFERRED_SIZE, 190, GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4,
GroupLayout.PREFERRED_SIZE, 192, Short.MAX_VALUE))
.addGap(43)

.addGroup(layout.createParallelGroup(Alignment.BASELINE)
.addComponent(jLabel5,
GroupLayout.PREFERRED_SIZE, 216, GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6,
GroupLayout.PREFERRED_SIZE, 216, GroupLayout.PREFERRED_SIZE))
.addContainerGap(583, Short.MAX_VALUE))
);
getContentPane().setLayout(layout);

pack();
}

private void jLabel7MouseClicked(java.awt.event.MouseEvent evt)


{
MenuPage obj =new MenuPage();
obj.setVisible(true);
dispose();
}

private void jLabel3MouseClicked(java.awt.event.MouseEvent evt)


{
EngDep obj=new EngDep();
obj.setVisible(true);
dispose();

private void jLabel4MouseClicked(java.awt.event.MouseEvent evt) {


phydep obj=new phydep();
obj.setVisible(true);
dispose();
}

private void jLabel5MouseClicked(java.awt.event.MouseEvent evt) {


chemdep obj=new chemdep();
obj.setVisible(true);
dispose();
}

private void jLabel6MouseClicked(java.awt.event.MouseEvent evt) {


NewspaperDep obj=new NewspaperDep();
obj.setVisible(true);
dispose();
}

public static void main(String args[])


{

java.awt.EventQueue.invokeLater(new Runnable()
{
public void run()
{
new LibDepartment().setVisible(true);
}
});
}

}
//Mech Dept page
import javax.swing.JOptionPane;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JTextField;
public class EngDep extends javax.swing.JFrame
{
private javax.swing.JComboBox<String> eng;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JButton sub;
private JButton sub1;
private JButton btnReturn;

public EngDep()
{
initComponents();
}
private void initComponents()
{

jLabel1 = new javax.swing.JLabel();


jLabel2 = new javax.swing.JLabel();
jLabel2.setFont(new Font("Tahoma", Font.BOLD, 11));
eng = new javax.swing.JComboBox<>();
sub = new javax.swing.JButton();
sub.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
jLabel3 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jLabel1.setFont(new java.awt.Font("Times New Roman", 3, 36)); // NOI18N


jLabel1.setText("Mechanical Department");

jLabel2.setText("Choose the Book");


JLabel lblIssued = new JLabel("");
lblIssued.setFont(new Font("Tahoma", Font.BOLD, 13));

eng.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "1- Theory of


Machines by J.K Gupta", "2- Engineering Mechanics by Hudey", "3- Thermodynamics by Hussain",
"4- Machinery Handbook", "5- Discovery of Fluid Dynamics by Henry", " " }));

sub.setText("NOT ISSUED");

jLabel3.setText("GO BACK");
jLabel3.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel3MouseClicked(evt);
}
});

sub1 = new JButton();


sub1.setText("OK");
sub1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt)
{
subActionPerformed(evt);
lblIssued.setText("ISSUED");
}
});

btnReturn = new JButton("Return");


btnReturn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(rootPane, "Book has been Returned");
sub.setText("NOT ISSUED");
lblIssued.setText(null);

}
});

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


layout.setHorizontalGroup(
layout.createParallelGroup(Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addGap(75)
.addComponent(jLabel2)
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(ComponentPlacement.RELATED, 328,
Short.MAX_VALUE)
.addComponent(jLabel3)
.addGap(47))
.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addGap(51)
.addComponent(lblIssued)

.addPreferredGap(ComponentPlacement.RELATED, 250, Short.MAX_VALUE)


.addComponent(sub))

.addGroup(layout.createParallelGroup(Alignment.LEADING, false)
.addGroup(Alignment.TRAILING,
layout.createSequentialGroup()
.addGap(33)
.addComponent(btnReturn,
GroupLayout.PREFERRED_SIZE, 104, GroupLayout.PREFERRED_SIZE)

.addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addComponent(sub1,
GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE))
.addComponent(eng,
Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
GroupLayout.PREFERRED_SIZE)))
.addGap(279))))
);
layout.setVerticalGroup(
layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(33)
.addComponent(jLabel1))
.addGroup(layout.createSequentialGroup()
.addGap(20)
.addComponent(jLabel3)))
.addGap(70)
.addGroup(layout.createParallelGroup(Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(eng, GroupLayout.PREFERRED_SIZE,
GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(ComponentPlacement.RELATED, 30,
Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(Alignment.BASELINE)
.addComponent(sub)
.addComponent(lblIssued, GroupLayout.PREFERRED_SIZE, 18,
GroupLayout.PREFERRED_SIZE))
.addGap(18)
.addGroup(layout.createParallelGroup(Alignment.BASELINE)
.addComponent(sub1)
.addComponent(btnReturn, GroupLayout.PREFERRED_SIZE, 23,
GroupLayout.PREFERRED_SIZE))
.addGap(22))
);
getContentPane().setLayout(layout);

pack();
}

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

sub.setText(eng.getSelectedItem().toString());

JOptionPane.showMessageDialog(rootPane, "Book has been Issued");


}

private void jLabel3MouseClicked(java.awt.event.MouseEvent evt) {


LibDepartment obj=new LibDepartment();
obj.setVisible(true);
dispose();
}

public static void main(String args[])


{

java.awt.EventQueue.invokeLater(new Runnable()
{
public void run() {
new EngDep().setVisible(true);
}
});
}
}
//Electronics Dept page
import javax.swing.JOptionPane;
import javax.swing.JButton;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.GroupLayout;
import javax.swing.JLabel;
import java.awt.Font;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class phydep extends javax.swing.JFrame


{
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JComboBox<String> phy;
private javax.swing.JButton sub;
private JButton button;
private JButton button_1;
private JLabel lblLabel;

public phydep()
{
initComponents();
}
private void initComponents() {

jLabel1 = new javax.swing.JLabel();


jLabel2 = new javax.swing.JLabel();
jLabel2.setFont(new Font("Tahoma", Font.BOLD, 11));
phy = new javax.swing.JComboBox<>();
sub = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jLabel1.setFont(new java.awt.Font("Times New Roman", 3, 36)); // NOI18N


jLabel1.setText("Electronics Department");

jLabel2.setText("Choose any book");


lblLabel = new JLabel("");
lblLabel.setFont(new Font("Tahoma", Font.BOLD, 13));

phy.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "1-


Classical mechanics.", "2- Thermodynamics and statistical mechanics.", "3-
Electromagnetism and electronics.", "4- Relativity.", "5- Quantum mechanics.", "6- Optics,
and atomic, molecular, and optical physics." }));

sub.setText("NOT ISSUED");
sub.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {

}
});
jLabel3.setText("GO BACK");
jLabel3.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel3MouseClicked(evt);
}
});

button = new JButton();


button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
subActionPerformed(e);
lblLabel.setText("ISSUED");

}
});
button.setText("OK");

button_1 = new JButton("Return");


button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(rootPane, "Book has been Returned");
sub.setText("NOT ISSUED");
lblLabel.setText(null);
}
});

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


layout.setHorizontalGroup(
layout.createParallelGroup(Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addGap(40)
.addComponent(jLabel2)
.addPreferredGap(ComponentPlacement.RELATED, 52,
Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(Alignment.TRAILING)
.addComponent(phy,
GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(Alignment.LEADING)
.addComponent(lblLabel,
GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE)

.addGroup(layout.createSequentialGroup()
.addGap(31)
.addComponent(button_1,
GroupLayout.PREFERRED_SIZE, 75, GroupLayout.PREFERRED_SIZE)))
.addGap(14)

.addGroup(layout.createParallelGroup(Alignment.TRAILING)
.addComponent(sub)

.addGroup(layout.createSequentialGroup()
.addComponent(button,
GroupLayout.PREFERRED_SIZE, 57, GroupLayout.PREFERRED_SIZE)

.addPreferredGap(ComponentPlacement.RELATED)))))
.addGap(159))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(ComponentPlacement.RELATED,
78, Short.MAX_VALUE)
.addComponent(jLabel3)
.addGap(42))))
);
layout.setVerticalGroup(
layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(21)
.addGroup(layout.createParallelGroup(Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jLabel3))
.addGap(71)
.addGroup(layout.createParallelGroup(Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(phy, GroupLayout.PREFERRED_SIZE,
GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(47)
.addGroup(layout.createParallelGroup(Alignment.BASELINE)
.addComponent(sub)
.addComponent(lblLabel, GroupLayout.PREFERRED_SIZE,
18, GroupLayout.PREFERRED_SIZE))
.addGap(29)
.addGroup(layout.createParallelGroup(Alignment.BASELINE)
.addComponent(button)
.addComponent(button_1))
.addContainerGap(101, Short.MAX_VALUE))
);
getContentPane().setLayout(layout);
pack();
}
private void subActionPerformed(java.awt.event.ActionEvent evt) {

sub.setText(phy.getSelectedItem().toString());
JOptionPane.showMessageDialog(rootPane, "Book has been Issued");

private void jLabel3MouseClicked(java.awt.event.MouseEvent evt) {


LibDepartment obj=new LibDepartment();
obj.setVisible(true);
dispose();
}

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(phydep.class.getName()).log(java.util.logging.Level.SEV
ERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(phydep.class.getName()).log(java.util.logging.Level.SEV
ERE, null, ex);
} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(phydep.class.getName()).log(java.util.logging.Level.SEV
ERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(phydep.class.getName()).log(java.util.logging.Level.SEV
ERE, null, ex);
}

java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new phydep().setVisible(true);
}
});
}

}
//CivilDept page
import javax.swing.JOptionPane;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.GroupLayout.Alignment;
import javax.swing.GroupLayout;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class chemdep extends javax.swing.JFrame


{

private javax.swing.JComboBox<String> chem;


private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JButton sub;
private JLabel lblLabel;
private JButton sub1;
private JButton button_1;

public chemdep()
{
initComponents();
}

private void initComponents() {


jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel3.setFont(new Font("Tahoma", Font.BOLD, 11));
chem = new javax.swing.JComboBox<>();
sub = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jLabel1.setFont(new java.awt.Font("Times New Roman", 3, 36)); // NOI18N


jLabel1.setText("Civil Department");

jLabel2.setText("GO BACK");
jLabel2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel2MouseClicked(evt);
}
});

jLabel3.setText("CHOOSE ANY BOOK");

chem.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "1- Fundamentals


of Civil Engineering", "2- Principle of Soil Dynamics", "3- Civil Engineering Materials", "4-
Introduction to Hydraulics", "5- Mechanical Excavation in Mining" }));

sub.setText("NOT ISSUED");
sub.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {

}
});
lblLabel = new JLabel("");
lblLabel.setFont(new Font("Tahoma", Font.BOLD, 13));

sub1 = new JButton();


sub1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
subActionPerformed(e);
lblLabel.setText("ISSUED");
}
});
sub1.setText("OK");

button_1 = new JButton("Return");


button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(rootPane, "Book has been Returned");
sub.setText("NOT ISSUED");
lblLabel.setText(null);
}
});

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


layout.setHorizontalGroup(
layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap(175, Short.MAX_VALUE)
.addComponent(jLabel1)
.addGap(95)
.addComponent(jLabel2)
.addGap(41))
.addGroup(layout.createSequentialGroup()
.addGap(86)
.addGroup(layout.createParallelGroup(Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(button_1,
GroupLayout.PREFERRED_SIZE, 74, GroupLayout.PREFERRED_SIZE)
.addGap(37)
.addComponent(sub1, GroupLayout.PREFERRED_SIZE,
61, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel3)
.addGap(93)

.addGroup(layout.createParallelGroup(Alignment.TRAILING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(lblLabel)

.addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addComponent(sub))
.addComponent(chem,
GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
GroupLayout.PREFERRED_SIZE))))
.addContainerGap(290, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(Alignment.LEADING)
.addComponent(jLabel1)
.addGroup(layout.createSequentialGroup()
.addGap(10)
.addComponent(jLabel2)))
.addGap(61)
.addGroup(layout.createParallelGroup(Alignment.BASELINE)
.addComponent(chem, GroupLayout.PREFERRED_SIZE,
GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3))
.addGap(42)
.addGroup(layout.createParallelGroup(Alignment.BASELINE)
.addComponent(sub)
.addComponent(lblLabel, GroupLayout.PREFERRED_SIZE, 18,
GroupLayout.PREFERRED_SIZE))
.addGap(31)
.addGroup(layout.createParallelGroup(Alignment.BASELINE)
.addComponent(sub1)
.addComponent(button_1))
.addContainerGap(161, Short.MAX_VALUE))
);
getContentPane().setLayout(layout);
pack();
}
private void jLabel2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-
FIRST:event_jLabel2MouseClicked
LibDepartment obj=new LibDepartment();
obj.setVisible(true);
dispose();
}

private void subActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_subActionPerformed

sub.setText(chem.getSelectedItem().toString());
JOptionPane.showMessageDialog(rootPane, "Book has been issued");
}
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(chemdep.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(chemdep.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(chemdep.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(chemdep.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new chemdep().setVisible(true);
}
});
}

}
//Computer Science Dept page
import javax.swing.JOptionPane;
import javax.swing.JButton;
import javax.swing.GroupLayout.Alignment;
import javax.swing.GroupLayout;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JLabel;
import java.awt.Font;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class NewspaperDep extends javax.swing.JFrame
{
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JComboBox<String> news;
private javax.swing.JButton sub;
private JButton button;
private JButton button_1;
private JLabel lblLabel

public NewspaperDep()
{
initComponents();
}
private void initComponents()
{
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel2.setFont(new Font("Tahoma", Font.BOLD, 11));
news = new javax.swing.JComboBox<>();
sub = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jLabel1.setFont(new java.awt.Font("Times New Roman", 3, 36)); // NOI18N


jLabel1.setText("Computer Science Department");

jLabel2.setText("Choose any Book:");

news.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "1- The Art of


Computer Programming", "2- Computer Organization and Design", "3- Computer Networking", "4-
Code Master by John", "5- Introduction to Java", "6- Introduction to Python " }));

sub.setText("NOT ISSUED");
sub.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {

}
});

jLabel3.setText("GO BACK");
jLabel3.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel3MouseClicked(evt);
}
});

button = new JButton("Return");


button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(rootPane, "Book has been returned");
sub.setText("NOT ISSUED");
lblLabel.setText(null);
}
});

button_1 = new JButton();


button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
subActionPerformed(e);
lblLabel.setText("ISSUED");
}
});
button_1.setText("OK");

lblLabel = new JLabel("");


lblLabel.setFont(new Font("Tahoma", Font.BOLD, 13));

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


layout.setHorizontalGroup(
layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap(207, Short.MAX_VALUE)
.addComponent(jLabel1)
.addGap(73)
.addComponent(jLabel3)
.addGap(41))
.addGroup(layout.createSequentialGroup()
.addGap(49)
.addGroup(layout.createParallelGroup(Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2)
.addGap(52)
.addComponent(news, GroupLayout.PREFERRED_SIZE,
GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(lblLabel,
GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
.addGap(64)
.addComponent(sub))
.addComponent(button_1, GroupLayout.PREFERRED_SIZE, 58,
GroupLayout.PREFERRED_SIZE))
.addContainerGap(375, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGap(271)
.addComponent(button, GroupLayout.PREFERRED_SIZE, 75,
GroupLayout.PREFERRED_SIZE)
.addContainerGap(473, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(24)
.addGroup(layout.createParallelGroup(Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jLabel3))
.addGap(44)
.addGroup(layout.createParallelGroup(Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(news, GroupLayout.PREFERRED_SIZE,
GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(ComponentPlacement.RELATED, 47,
Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(Alignment.BASELINE)
.addComponent(sub)
.addComponent(lblLabel, GroupLayout.PREFERRED_SIZE, 18,
GroupLayout.PREFERRED_SIZE))
.addGap(31)
.addGroup(layout.createParallelGroup(Alignment.BASELINE)
.addComponent(button)
.addComponent(button_1))
.addContainerGap(173, Short.MAX_VALUE))
);
getContentPane().setLayout(layout);

pack();
}
private void subActionPerformed(java.awt.event.ActionEvent evt) {
sub.setText(news.getSelectedItem().toString());
JOptionPane.showMessageDialog(rootPane, "Book has been issued");

}
private void jLabel3MouseClicked(java.awt.event.MouseEvent evt) {
LibDepartment obj=new LibDepartment();
obj.setVisible(true);
dispose();
}

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(NewspaperDep.class.getName()).log(java.util.logging.Level.SEV
ERE, null, ex);
} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(NewspaperDep.class.getName()).log(java.util.logging.Level.SEV
ERE, null, ex);
} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(NewspaperDep.class.getName()).log(java.util.logging.Level.SEV
ERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(NewspaperDep.class.getName()).log(java.util.logging.Level.SEV
ERE, null, ex);
}

java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new NewspaperDep().setVisible(true);
}
});
}

}
Output

/*Paste the screenshots*/

S-ar putea să vă placă și