0% found this document useful (0 votes)
7 views

ASSIGMENT Programming 2

Uploaded by

Luisendorf
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

ASSIGMENT Programming 2

Uploaded by

Luisendorf
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 42

NEWI

Department of Computing

Computing Undergraduate Programme


Level:

Module: COM222

Assignment: Call centre program

Issue Date: 22nd Oct 2007

Review Date:

Final Submission Date: Week beginning 10th Dec 2007

Estimated Completion time: 30 Hours

Lecturer: Stephen Caulder

Verified by:

To be completed by student:

I certify that this work is the Name: LUIS DE LEON SASTRE


result of my individual effort Student Number S07001907
and that all sources for
Date Submitted: 9-01-08
materials have been
acknowledged. Student Signature: .....................................................
If the assignment has been submitted electronically then please indicate the file pathname:
………………………………………………………………………………………………………………….………
To be completed by lecturer
Comments:

Grade / Mark
(Indicative: may change when
moderated)

If Mitigating Circumstances are being claimed then please indicate your Code

Number: ............................................

1
INDEX

TASK 1.1 4

What is a Class Diagram? --------------------------------------------------- 4

What is a Constructor?------------------------------------------------------- 4

What is an accessor?---------------------------------------------------------- 6

What is a Transformers?----------------------------------------------------- 7

8
TASK 1.2
What is an Static variable?--------------------------------------------------- 8

Examples:----------------------------------------------------------------------- 8

TASK 1.3 11

Diagram of a Class: Class person.------------------------------------------ 11

TASK 2 12

Objetive and introduction--------------------------------------------------- 12

Class Main2, Class Jinsertar and Class Jmostrar---------------------- 12

Class Date ---------------------------------------------------------------------- 13

Class Hour---------------------------------------------------------------------- 13

Class Vector-------------------------------------------------------------------- 14

User Manual of the Graphical part---------------------------------------. 15

Star………..……………………………………………………….. 15

2
Take out first position-------------------------------------------------------------------- 16

Show all queue----------------------------------------------------------

Take out the position (0-7)--------------------------------------------------------------- 19

Java code in classes------------------------------------------------------------- 22

Class Person-------------------------------------------------------------------- 22

Class Vector-------------------------------------------------------------------- 23

Class Date----------------------------------------------------------------------- 24

Class Hour---------------------------------------------------------------------- 25

Class Main2-------------------------------------------------------------------------------- 26

Class Jinsertar---------------------------------------------------------- 32

Class Jmostrar------------------------------------------------------------------ 37

Bibliography and references------------------------------------------------------------ 42

3
Task 1.1

_________________What is a Diagram Class?_____________________


A graph of Classes represents the classes that will be used inside the system and the
relations that exist between them.
The graphs of Classes for definition are static, this is, they represent that parts interact
between them. It is important to distinguish between the concepts of class and object:
Class:
He is an abstract model of a type of object. It defines his methods and attributes.
object:
It is an instance of a class, that is to say, the implementation with values of an abstract
model.
Knowing the difference, we can have more knowledge to choose well the way of
designing our project in java, using the attributes and methods necessary for his
construction.

What is a Constructor?_______________________

The constructor for a class is a standard method to initialize the objects in that class. It is
invoked automatically when new create an object of that class.

Ref: http://java.sun.com/j2se/1.4.2/docs/api/java/

The constructors declare themselves in the moment to define the class

class A {
int x, y;
A() { x=0; y=0; } // constructor
...
}

A a= new A();
a.Print(); // 0 0

The constructor can have parameters. In this case, the respective arguments must be
placed on having created the object:

class A {
int x, y;
A(int ix, int iy)
{ x=ix; y=iy; } // constructor
...
}

A a= new A(1,2);

4
a.Print(); // 1 2

a= new A(); // error, needs the arguments

a.A(1,2); // error, it is imposible


// to invoke the constructor

Several constructors can place. During the creation of an object, there is invoked that
one that wears shoes with the given arguments:

class A {
int x, y;
A() { x=0; y= 0; }
A(int ix, int iy)
{ x=ix; y=iy; }
A(A from)
{ x= from.x; y= from.y; }
...
}

A a1= new A();


a1.Print(); // 0 0
A a2= new A(1,2);
a2.Print(); // 1 2
A a3= new A(a2);
a3.Print(); // 1 2

Examples for Constructors of my assegment:

public person(String n,String d, String t)


{
this.Name=n;
this.Date=d;
this.Time=t;
}

public person()
{
this.Name="";
this.Date="";
this.Time="";
}

public Date(){
Calendar hoy = Calendar.getInstance();
this.day = hoy.get(Calendar.DAY_OF_MONTH);
this.month = hoy.get(Calendar.MONTH)+1;
this.year = hoy.get(Calendar.YEAR);
}

5
public Hour(){
Calendar hoy = Calendar.getInstance();
this.hour = hoy.get(Calendar.HOUR_OF_DAY);
this.minutes = hoy.get(Calendar.MINUTE);
this.seconds = hoy.get(Calendar.SECOND);
}

public vector()
{
this.vpersonas=new Vector(8);
}

What is an Accessor?__________________________

The accessor is a method that we use to return information about the state of an object.
Is a method that accesses in the object attributes and return the result of those attributes.

Ref: http://java.sun.com/j2se/1.4.2/docs/api/java/

Example of accessors (consultations of attributes) of the practice:

public String getName()


{
return this.Name;
}

public String getDate()


{
return this.Date;
}

public String getTime()


{
return this.Time;
}

public String getDay(){return this.dayEnCadena=dayEnCadena.valueOf(day);}

public String getMonth(){return this.monthEnCadena=monthEnCadena.valueOf


(month);}

public String getYear(){return this.yearEnCadena=yearEnCadena.valueOf(year);}

6
public String getHour(){return this.hourEnCadena=hourEnCadena.valueOf(hour);}

public String getMinutes(){return


this.minutesEnCadena=minutesEnCadena.valueOf (minutes);}

public String getSeconds(){return


this.secondsEnCadena=secondsEnCadena.valueOf (seconds);}

There are more in the practic.

What is a Transformer?__________________________

The transformers are methods that are used to alter the state of an object giving value to
the attributes. The transformers return nothing. We have used the second constructor of
the class person which creates an object with the values blank "new person ()" so we
need some methods to give value to the attributes of the new object.

Ref: http://java.sun.com/j2se/1.4.2/docs/api/java/

Example of transformers (modifiers of attributes) of the practice:

public void setName(String n)


{
this.Name=n;
}

public void setDate(String d)


{
this.Date=d;
}

public void setTime(String t)


{
this.Time=t;
}

7
Task 1.2

What is a static variable?__________________________

A class can have own variables of the class and not of every object. To these variables
there is called them variables of class or changeable static. Static they are in the habit of
the variables using to define common constants for all the objects of the class. The
variables member static believe themselves in the moment in which they can be
necessary: when the first object of the class is going to be created, in all that it calls to a
method static or in all that a variable is in use static of the above mentioned class. The
important thing is that the variables member static initialize always before that any
object of the class.

Ref: http://www.usuario.com/informacion/Java_TXT/JAVA-25.html
For example :

class Main.2
{
static int zero = 0;
}

One already declared the static variable, in all the places where there are 0, it is
necessary to put the constant "zero".

Examples where the static variable is used in the practice:

 private void formWindowClosed(java.awt.event.WindowEvent evt) {


// TODO add your handling code here:
JOptionPane.showMessageDialog(this,"Fin de la
aplicación","MENSAJE",JOptionPane.INFORMATION_MESSAGE);
System.exit(zero);

 private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
int aux;
person persona;

aux = vpersonas.getsize();
if (aux>zero)
{
persona = vpersonas.deletePerson();
JOptionPane.showMessageDialog(this,"Se ha eliminado la posicion 0 de la
cola correctamente","MENSAJE",JOptionPane.INFORMATION_MESSAGE);
}
else
{
JOptionPane.showMessageDialog(this,"La cola esta vacia no se puede
eliminar a nadie","MENSAJE",JOptionPane.INFORMATION_MESSAGE);
}

8
}

 private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
JOptionPane.showMessageDialog(this,"Fin de la
aplicación","MENSAJE",JOptionPane.INFORMATION_MESSAGE);
System.exit(zero);

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


// TODO add your handling code here:
int aux;
String nombre = jTextField1.getText();
int opcion ;
person persona;

 if (!nombre.equals(""))
{
aux = vpersonas.getsize();
opcion= Integer.parseInt(jTextField1.getText());

if (aux == zero)
{
JOptionPane.showMessageDialog(this,"The queue is empty, it is
impossible to erase anybody","MENSAJE",JOptionPane.WARNING_MESSAGE);
}
else
{
if (opcion < aux)
{
persona = vpersonas.deletePersonAt(opcion);
opcion = opcion + 1;
JOptionPane.showMessageDialog(this,"It has been erased
correctly","ERROR",JOptionPane.WARNING_MESSAGE);
}
else
{
JOptionPane.showMessageDialog(this,"There aren’t anybody in
this position","MENSAJE",JOptionPane.WARNING_MESSAGE);
}
}
}
else
{
JOptionPane.showMessageDialog(this,"Introduce one number from 0 to
7","ERROR",JOptionPane.WARNING_MESSAGE);

9
}
}

}
}

10
Task 1.3

Diagram of a class:

Now we can observe in a graph of a class, the parts corresponding to the


previous points: Constructorr, assesor and transformers.

Class Person:

person Class name


name
date
time Attributes

constructor person()
person(strin,string,string9

accessor getname
getdate
gettime Methods

setname
transformers setdate
settime

In this class, class person, we can find 3 parts, the name of the class, whom is person,
the differents attributes, which are name, date and time, and then, we can see the three
diferents Methosd: Constructor , it will be person(), (always with the same name of the
class) Accessor, that returns the variable values of one object (getnama, getdate gettime)
and transformers, that his function is change the variables, (setname, setdate, settime).

11
Task 2

Objective and Introduction

The Objetive of the practice is to develop a kind of notebook, in which there exists a
queue of client or users, which could be added to the queue and erase of the queue, for it
we need that the queue is of type FIFO, in addition it is necessary that it appears the
date and the hour of every client when he enters the queue. For it I have created the
Class Person, that it has of attributes, name dates and hour; the Class Vector, that this
limited to 8 clients, and in that they guard by means of FIFO, the clients' queue. In
addition I have the Class Dates and the Class Hour, that both depend on the Class
Calendar, to show the hour and the date of entry of the client in the tail. There are 3
classes more, the Class Main2, and other two Classes for the graphical part of the
practice.

Class Main2 : Class JInsertar and Jmostrar

The Main2 class, it consists in his totality of the graphical part of the practice, Where
you can insert the clients in the queue, see the position of every client, eliminate the first
client of the queue, and eliminate a client of a certain position of the queue.
In turn certainly, the principal class calls to the class Jinsertar that it inserts clients, and
Jmostrar, which show clients. This classes are make with netbeans program, and their
code is complicated, because them have buttons and panels with a several lines of code
but these code is always generate from java with netbeans.

JInsertar
Main2 principal
vpersonas
vpersonas
zero jInsertar(jframe,vector)
jButton1ActionPerformed()
jButton2ActionPerformed()
formwindowclosed()

Main2()
Jmostrar
jButton1ActionPerformed() Principal
jButton2ActionPerformed() vpersonas
jButton3ActionPerformed()
jButton4ActionPerformed()
jButton5ActionPerformed() Jmostrar(jframe,vector)
formwindowclosed() jButton2ActionPerformed()
formwindowclosed()
12
Class Date
In the class Date, we have the attributes year, month and day, but this class, there
depends directly on a class imported of java, that is the class calendar. So much in the
class it dates as like in the class hour in the builder the first line creates an object of type
calendar in case of the date today, in case of hour today also, and in this object already a
few attributes exist so called minute, second, year, month…etc
The class calendar creates an object with the day month year, hour the second minute,
and today is an object of type calendar, that is it who contains all the attributes.

Date
day
month
year Calendar
Class import java
person() Util java
setDay()
setMonth() import java.io.*;
setyear() import java.util.*;
getDay()
setMonth()
getYear()

Class Hour

This class is the same that Date class, it depends first from the Calendar class, because
to the constructor, does not pass parameter to him beacuse he accedes to the class
Calendar. His attributes are Hour Minute and Seconds. And then it has his Methods.
The Class Hour and the Class Date could be together, but is more easy to see the
concept if they are separated.

Hour
_____________________
Hour()
Minute() Calendar
Second() Class import java
____________________ Util java.
getHour()
setHour() import java.io.*;
getMinute() import java.util.*;
setMinute()
getSecond()
setSecond()
13
Class Vector

In the Class Vector, we have only one attribute, Vpersonas, Its will be the vector that
we will use to introduce in the queue clients, with a limit for 8 clients. In this vector, Its
possible to add a client, erase a client, and erase one client with a previously position.

Vector
_____________________
vpersonas
_____________________
vector()
getObject()
Class Hour
addElement()
deletePerson()
deletePersonAt()
getmax()
getsize()

14
User's manual of the graphical part

Start:

Since we can observe, on having executed the program in java, the graphical part, it
shows us a menu.
In the menu, several options appear for the user, among them there are:

Insert of the queue

take out the first position

take out the position (0-7)

show all queue

exit

fig nº 1

15
Insert of the queue:

We choose insert of the queue, then another window appears, indicating the name of the
person to us to add in the queue, and the hour, in hours, minutes and seconds, and the
date in day, month and year of when we introduce him in the queue.

fig 02.

Note: Allways appears the return button to return to previous screen.

16
We can write the name of the client to add to the queue and next press the button insert,
and the next message appears on the screen:

fig 03

Now, we have one client add in the queue.

Next we must press Aceptar Button to continue.

When we press the Accept Button, we can add another client on the queue, or we can
return to the previously screen and select another option from the menu.

When we had introduce 8 clients in the queue, (limit is 8 clients) appears the next
message on the screen: (see fig 04).

17
fig 04

Now, we can’t introduce more clients in the queue, so we must to press accept and then
return to choose another option from the menu.

Take out the first position

If we have chosen the option 2, take out the first position, the program will erase the
client who was in the initial position, the first introduced client. And it was displacing a
position towards the left side to the rest of clients who exist in the queue. passing the
client number 2 to being the number 1 in the queue.

On the screen we can see the next message:


(see fig 05).

18
fig 05

Show all queue:

At any time we can choose the option 4. Show all queue to see the state of the clients'
queue. We will be able to observe the clients who exist, and the hour and the date of
when they were introduced.

19
Take out the position (0-7):

Choosing this option of the menu, we eliminate the client of the queue who occupies the
position X that the user must introduce.

fig 07

If the user introduces a position that does not exist or that not occupied this one, and if
the queue is empty, on the screen will appears the followings messages.

(see fig 08 and fig 09).

20
fig 08

fig 09

21
Java code in classes

Class person

public class person {


private String Name;
private String Date;
private String Time;

public person(String n,String d, String t)


{
this.Name=n;
this.Date=d;
this.Time=t;
}
public person()
{
this.Name="";
this.Date="";
this.Time="";
}

public void setName(String n)


{
this.Name=n;
}

public String getName()


{
return this.Name;
}

public void setDate(String d)


{
this.Date=d;
}

public String getDate()


{
return this.Date;
}

public void setTime(String t)


{
this.Time=t;
}

22
public String getTime()
{ return this.Time; }
}

Class vector

import java.util.Vector;

public class vector {

private Vector vpersonas;

public vector()
{
this.vpersonas=new Vector(8);
}

public person getObject(int pos)


{
Object aux=this.vpersonas.get(pos);
person auxp=(person) aux;
return auxp;
}

public void addElement(person persona)


{
this.vpersonas.addElement(persona);
}

public person deletePerson()


{
Object aux=this.vpersonas.remove(0);
person auxp=(person) aux;
return auxp;
}

public person deletePersonAt(int pos)


{
Object aux=this.vpersonas.remove(pos);
person auxp=(person) aux;
return auxp;
}

public boolean getmax()


{
int n;
n=this.vpersonas.size();

23
if (n<8)
{
return true;
}
else
{
return false;
}
}

public int getsize()


{
return this.vpersonas.size();
}

Class Date

public class Date implements Serializable


{
private int day; // day in integer format
private int month; // month in integer format
private int year; //year in integer format
private String dateEnCadena; // today date in format string
private String dayEnCadena; // day in format string
private String monthEnCadena; // month in format string
private String yearEnCadena; // year in format string

/**Constructor, depends of class calendar*/


public Date(){
Calendar hoy = Calendar.getInstance();
this.day = hoy.get(Calendar.DAY_OF_MONTH);
this.month = hoy.get(Calendar.MONTH)+1;
this.year = hoy.get(Calendar.YEAR);
}

// Methods
/**Method which returns the day in string format*/
public String getDay(){return this.dayEnCadena=dayEnCadena.valueOf(day);}

/**Method which returns the month in string format*/


public String getMonth(){return this.monthEnCadena=monthEnCadena.valueOf
(month);}

/**Method which returns the month in string format*/


public String getMonth2(){
switch (this.month){

24
case 1: monthEnCadena = "January";break;
case 2: monthEnCadena = "Febrary";break;
case 3: monthEnCadena = "March";break;
case 4: monthEnCadena = "April"; break;
case 5: monthEnCadena = "May"; break;
case 6: monthEnCadena = "Juny"; break;
case 7: monthEnCadena = "July";break;
case 8: monthEnCadena = "Augost";break;
case 9: monthEnCadena = "September";break;
case 10: monthEnCadena = "October";break;
case 11: monthEnCadena = "November";break;
case 12: monthEnCadena = "Dicember";break;
}
return monthEnCadena;
}

/**Method which returns the year in string format */


public String getYear(){return
this.yearEnCadena=yearEnCadena.valueOf(year);}

/**Method which returns the year in string number format*/


public String getDate(){return (getDay()+"/"+getMonth()+"/"+getYear());}

/**Method which returns the date in another diferent date format*/


public String getDate2(){return (getDay()+"-"+getMonth2()+"-"+getYear());}
}

Class Hour

public class Hour implements Serializable


{
private int hour;
private int minutes;
private int seconds;
private String HourEnCadena;
private String hourEnCadena;
private String minutesEnCadena;
private String secondsEnCadena;

/**Constructor, depends of class calendar*/


public Hour(){
Calendar hoy = Calendar.getInstance();
this.hour = hoy.get(Calendar.HOUR_OF_DAY);
this.minutes = hoy.get(Calendar.MINUTE);
this.seconds = hoy.get(Calendar.SECOND);
}

25
public String getHour(){return this.hourEnCadena=hourEnCadena.valueOf(hour);}

public String getMinute(){return


this.minutesEnCadena=minutesEnCadena.valueOf (minutes);}

public String getSeconds(){return


this.secondsEnCadena=secondsEnCadena.valueOf (seconds);}

/**Método que devuelve la hora en string de números*/


public String getHourTotal()
{
return getHour()+":"+this.getMinute()+":"+getSeconds();
}

Class Main2

public class Main2 extends javax.swing.JFrame {


vector vpersonas=new vector();
static int cero = 0;

/** Creates new form Main2 */


public Main2() {
initComponents();

/** This method is called from within the constructor to


* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-
BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jButton5 = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();

26
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("APLICACION JAVA");
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosed(java.awt.event.WindowEvent evt) {
formWindowClosed(evt);
}
});

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


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

jButton2.setText("TAKE OUT THE FIRST POSITION");


jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});

jButton3.setText("TAKE OUT THE POSITION (0-7) :");


jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});

jButton4.setText("SHOW ALL QUEUE");


jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});

jButton5.setText("EXIT ");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});

jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18));


jLabel1.setText("APLICATI\u00d3N JAVA FOR GESTI\u00d3N OF A
QUEUE");

27
javax.swing.GroupLayout jPanel1Layout = new
javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(143, 143, 143)
.addComponent(jLabel1))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(224, 224, 224)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayou
t.Alignment.LEADING, false)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.R
ELATED)
.addComponent(jTextField1, 0, 10, Short.MAX_VALUE))
.addComponent(jButton2,
javax.swing.GroupLayout.DEFAULT_SIZE, 237, Short.MAX_VALUE)
.addComponent(jButton1,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton4,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton5,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addContainerGap(168, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(49, 49, 49)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 45,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(34, 34, 34)
.addComponent(jButton1)
.addGap(17, 17, 17)
.addComponent(jButton2)
.addGap(16, 16, 16)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.BASELINE)
.addComponent(jButton3)

28
.addComponent(jTextField1,
javax.swing.GroupLayout.PREFERRED_SIZE, 22,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(19, 19, 19)
.addComponent(jButton4)
.addGap(18, 18, 18)
.addComponent(jButton5)
.addContainerGap(123, Short.MAX_VALUE))
);

javax.swing.GroupLayout layout = new


javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
java.awt.Dimension screenSize =
java.awt.Toolkit.getDefaultToolkit().getScreenSize();
setBounds((screenSize.width-709)/2, (screenSize.height-436)/2, 709, 436);
}// </editor-fold>//GEN-END:initComponents

private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-


FIRST:event_formWindowClosed
// TODO add your handling code here:
JOptionPane.showMessageDialog(this,"Fin de la
aplicación","MENSAJE",JOptionPane.INFORMATION_MESSAGE);
System.exit(cero);
}//GEN-LAST:event_formWindowClosed

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


FIRST:event_jButton4ActionPerformed
// TODO add your handling code here:
Jmostrar objetoMostrar = new Jmostrar(this, vpersonas);
setVisible(false);
}//GEN-LAST:event_jButton4ActionPerformed

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


FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
int aux;
String name = jTextField1.getText();
int opcion ;
person persona;

29
if (!name.equals(""))
{
aux = vpersonas.getsize();
opcion= Integer.parseInt(jTextField1.getText());

if (aux == cero)
{
JOptionPane.showMessageDialog(this,"The queue is empty, impossible to
erase anybody","MENSAJE",JOptionPane.WARNING_MESSAGE);
}
else
{
if (opcion < aux)
{
persona = vpersonas.deletePersonAt(opcion);
opcion = opcion + 1;
JOptionPane.showMessageDialog(this,"Erase
correctly","ERROR",JOptionPane.WARNING_MESSAGE);
}
else
{
JOptionPane.showMessageDialog(this,"There isnt anybody in this
position","MENSAJE",JOptionPane.WARNING_MESSAGE);
}
}
}
else
{
JOptionPane.showMessageDialog(this,"Introduzca un número del 0 al
7","ERROR",JOptionPane.WARNING_MESSAGE);
}
}//GEN-LAST:event_jButton3ActionPerformed

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


FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
int aux;
person persona;

aux = vpersonas.getsize();
if (aux>cero)
{
persona = vpersonas.deletePerson();
JOptionPane.showMessageDialog(this,"The position 0 has been erased
correctly from the queue","MENSAJE",JOptionPane.INFORMATION_MESSAGE);
}
else
{

30
JOptionPane.showMessageDialog(this,"The queue is empty, its
impossible to erase
anybody","MENSAJE",JOptionPane.INFORMATION_MESSAGE);
}

}//GEN-LAST:event_jButton2ActionPerformed

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


FIRST:event_jButton5ActionPerformed
// TODO add your handling code here:
JOptionPane.showMessageDialog(this,"End of the
aplicatión","MENSAJE",JOptionPane.INFORMATION_MESSAGE);
System.exit(cero);
}//GEN-LAST:event_jButton5ActionPerformed

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


FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
JInsertar objetoInsertar = new JInsertar(this, vpersonas);
setVisible(false);
}//GEN-LAST:event_jButton1ActionPerformed

/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
Main2 panelPrincipal= new Main2();
panelPrincipal.setVisible(true);
}
});
}

// Variables declaration - do not modify//GEN-BEGIN:variables


private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
private javax.swing.JTextField jTextField1;
// End of variables declaration//GEN-END:variables

Class Jinsertar

public class JInsertar extends javax.swing.JFrame {

31
private JFrame principal;
private vector vpersonas;

/** Creates new form JInsertar */


public JInsertar(JFrame ventana, vector vpersona) {
initComponents();
principal = ventana;
vpersonas = vpersona;
principal.setVisible(false);
this.setVisible(true);
jTextField2.setText(new Date().getDate2());//fecha actual
jTextField3.setText(new Hour().getHourTotal());//hora actual
}

/** This method is called from within the constructor to


* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-
BEGIN:initComponents
private void initComponents() {
javax.swing.JButton jButton2;

jPanel1 = new javax.swing.JPanel();


jButton1 = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jButton2 = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jTextField3 = new javax.swing.JTextField();

setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosed(java.awt.event.WindowEvent evt) {
formWindowClosed(evt);
}
});

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


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

32
});

jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18));


jLabel1.setText("APLICATION JAVA FOR GESTION OF A QUEUE");

jButton2.setText("RETURN");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});

jLabel2.setText("NAME");

jLabel3.setText("DATE");

jLabel4.setText("HOUR");

jTextField2.setEditable(false);

jTextField3.setEditable(false);

javax.swing.GroupLayout jPanel1Layout = new


javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(143, 143, 143)
.addComponent(jLabel1))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(119, 119, 119)
.addComponent(jButton1,
javax.swing.GroupLayout.PREFERRED_SIZE, 200,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELA
TED)
.addComponent(jButton2,
javax.swing.GroupLayout.PREFERRED_SIZE, 200,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(175, 175, 175)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayou
t.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING,
jPanel1Layout.createSequentialGroup()

33
.addComponent(jLabel4,
javax.swing.GroupLayout.PREFERRED_SIZE, 160,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.R
ELATED)
.addComponent(jTextField3,
javax.swing.GroupLayout.PREFERRED_SIZE, 160,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING,
jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupL
ayout.Alignment.LEADING)
.addComponent(jLabel2,
javax.swing.GroupLayout.PREFERRED_SIZE, 160,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3,
javax.swing.GroupLayout.PREFERRED_SIZE, 160,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.R
ELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupL
ayout.Alignment.LEADING, false)
.addComponent(jTextField2,
javax.swing.GroupLayout.PREFERRED_SIZE, 160,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField1,
javax.swing.GroupLayout.DEFAULT_SIZE, 160, Short.MAX_VALUE))))))
.addContainerGap(175, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(49, 49, 49)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 45,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(28, 28, 28)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.BASELINE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE,
30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField1,
javax.swing.GroupLayout.PREFERRED_SIZE, 30,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED
)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.BASELINE)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE,
30, javax.swing.GroupLayout.PREFERRED_SIZE)

34
.addComponent(jTextField2,
javax.swing.GroupLayout.PREFERRED_SIZE, 30,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED
)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.LEADING)
.addComponent(jTextField3,
javax.swing.GroupLayout.PREFERRED_SIZE, 30,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE,
30, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED
, 83, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.BASELINE)
.addComponent(jButton1)
.addComponent(jButton2))
.addGap(96, 96, 96))
);

javax.swing.GroupLayout layout = new


javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
);
java.awt.Dimension screenSize =
java.awt.Toolkit.getDefaultToolkit().getScreenSize();
setBounds((screenSize.width-709)/2, (screenSize.height-436)/2, 709, 436);
}// </editor-fold>//GEN-END:initComponents

//para insertar un elemento persona en el vector (TO INSERT ONE ELEMENT ON


THE VECTOR)
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
String name, date, hour;
person persona;

name = jTextField1.getText();

35
date = jTextField2.getText();
hour = jTextField3.getText();

if (!name.equals("")){
if(vpersonas.getmax()==true)
{
name = jTextField1.getText();
date = jTextField2.getText();
hour = jTextField3.getText();
persona = new person(name,date,hour);
vpersonas.addElement(persona);
JOptionPane.showMessageDialog(this,"The name has been introduced in
the queue correctly","MENSAJE",JOptionPane.INFORMATION_MESSAGE);
}
else
{
JOptionPane.showMessageDialog(this,"The queue is
full","MENSAJE",JOptionPane.INFORMATION_MESSAGE);
}
}
else {JOptionPane.showMessageDialog(this,"Introduce one name
please","MENSAJE",JOptionPane.WARNING_MESSAGE);}
}//GEN-LAST:event_jButton1ActionPerformed

//to close the window


private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-
FIRST:event_formWindowClosed
// TODO add your handling code here:
this.setVisible (false);
principal.setVisible (true);
}//GEN-LAST:event_formWindowClosed
//boton volver
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
this.setVisible (false);
principal.setVisible (true);
}//GEN-LAST:event_jButton2ActionPerformed

// Variables declaration - do not modify//GEN-BEGIN:variables


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.JPanel jPanel1;
private javax.swing.JTextField jTextField1;

36
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
// End of variables declaration//GEN-END:variables

Class Jmostrar

public class Jmostrar extends javax.swing.JFrame {


private JFrame principal;
private vector vpersonas;

/** Creates new form Jmostrar */


public Jmostrar(JFrame ventana, vector vpersona) {
initComponents();
principal = ventana;
vpersonas = vpersona;
principal.setVisible(false);
this.setVisible(true);
jLabel2.setText("NAME : "+vpersona.getObject(0).getName()+" DATE :
"+vpersona.getObject(0).getDate()+" HOUR : "+vpersona.getObject(0).getTime() );
jLabel3.setText("NAME : "+vpersona.getObject(1).getName()+" DATE :
"+vpersona.getObject(1).getDate()+" HOUR : "+vpersona.getObject(1).getTime() );
jLabel4.setText("NAME : "+vpersona.getObject(2).getName()+" DATE :
"+vpersona.getObject(2).getDate()+" HOUR : "+vpersona.getObject(2).getTime() );
jLabel5.setText("NAME : "+vpersona.getObject(3).getName()+" DATE :
"+vpersona.getObject(3).getDate()+" HOUR : "+vpersona.getObject(3).getTime() );
jLabel6.setText("NAME : "+vpersona.getObject(4).getName()+" DATE :
"+vpersona.getObject(4).getDate()+" HOUR : "+vpersona.getObject(4).getTime() );
jLabel7.setText("NAME : "+vpersona.getObject(5).getName()+" DATE :
"+vpersona.getObject(5).getDate()+" HOUR : "+vpersona.getObject(5).getTime() );
jLabel8.setText("NAME : "+vpersona.getObject(6).getName()+" DATE :
"+vpersona.getObject(6).getDate()+" HOUR : "+vpersona.getObject(6).getTime() );
jLabel9.setText("NAME : "+vpersona.getObject(7).getName()+" DATE :
"+vpersona.getObject(7).getDate()+" HOUR : "+vpersona.getObject(7).getTime() );

/** This method is called from within the constructor to


* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-
BEGIN:initComponents

37
private void initComponents() {
javax.swing.JButton jButton2;

jPanel1 = new javax.swing.JPanel();


jLabel1 = new javax.swing.JLabel();
jButton2 = new javax.swing.JButton();
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();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosed(java.awt.event.WindowEvent evt) {
formWindowClosed(evt);
}
});

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


jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18));
jLabel1.setText("APLICATI\u00d3N JAVA FOR GESTI\u00d3N OF A
QUEUE");

jButton2.setText("VOLVER");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});

javax.swing.GroupLayout jPanel1Layout = new


javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jPanel1Layout.createSequentialGroup()
.addContainerGap(227, Short.MAX_VALUE)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE,
200, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(347, 347, 347))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(143, 143, 143)

38
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.LEADING)
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE,
400, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE,
400, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE,
400, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE,
400, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE,
400, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE,
400, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE,
400, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE,
400, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(231, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(49, 49, 49)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 45,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(6, 6, 6)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 15,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED
)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 15,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED
)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 15,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED
)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 15,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED
)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 15,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED
)

39
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 15,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED
)
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 15,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED
)
.addComponent(jLabel9)
.addGap(60, 60, 60)
.addComponent(jButton2)
.addContainerGap(119, Short.MAX_VALUE))
);

javax.swing.GroupLayout layout = new


javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
java.awt.Dimension screenSize =
java.awt.Toolkit.getDefaultToolkit().getScreenSize();
setBounds((screenSize.width-709)/2, (screenSize.height-436)/2, 709, 436);
}// </editor-fold>//GEN-END:initComponents

private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-


FIRST:event_formWindowClosed
// TODO add your handling code here:
this.setVisible(false);
principal.setVisible(true);
}//GEN-LAST:event_formWindowClosed

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


FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
this.setVisible(false);
principal.setVisible(true);
}//GEN-LAST:event_jButton2ActionPerformed

40
// Variables declaration - do not modify//GEN-BEGIN:variables
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.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
// End of variables declaration//GEN-END:variables

Bibliography and References:

http://java.sun.com/j2se/1.4.2/docs/api/java/

for java definitions and components.

http://www.usuario.com/informacion/Java_TXT/JAVA-25.html

for statics variables and information about variables in java.

41
http://www.osmosislatina.com/lenguajes/uml/clasesob.htm

for class diagrams and definitions about class and object

http://www.netbeans.org/

for get and manage the program to create the java code and the graphical interface.

42

You might also like