Final
Final
Submitted to:
Engr. Darvin Taghoy
Professor: CpE 331/L
Submitted by:
Noel Arcenio Portillo
April 2, 2018
UML
Source Code:
ProjectF1.java icon = new JLabel();
package projectf1; icon.setIcon(new ImageIcon(path));
add(icon);
import java.awt.FlowLayout; add(lblUser);
import java.awt.event.ActionEvent; add(txtUser);
import java.awt.event.ActionListener; add(lblPass);
import javax.swing.*; add(txtPass);
import javax.swing.ImageIcon; add(btnLogin);
public class ProjectF1 extends JFrame { add(btnCancel);
private JButton btnLogin,btnCancel;
private JLabel lblUser,lblPass, icon;
private JTextField txtUser; btnLogin.addActionListener(new
ActionListener() {
private JPasswordField txtPass;
@Override
clsConnection connE = new
clsConnection(); public void
actionPerformed(ActionEvent e) {
public ProjectF1(){
initGUI();
connE.Search(txtUser.getText(),txtPass.g
} etText());
JOptionPane.showMessageDialog(null,
try{ "Invalid Username or Password!");
Class.forName(strDriver); }
rs.close(); * This method is called from within the
constructor to initialize the form.
conn.close();
* WARNING: Do NOT modify this
}catch(Exception e){
code. The content of this method is
e.printStackTrace(); always
} */
} @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed"
desc="Generated Code">
void Search(String text) {
private void initComponents() {
throw new
UnsupportedOperationException("Not
supported yet."); //To change body of
jLabel2 = new javax.swing.JLabel();
generated methods, choose Tools |
Templates. jLabel1 = new javax.swing.JLabel();
} Main = new javax.swing.JButton();
} SalesOrder = new
javax.swing.JButton();
Main_Admin.java
Clients = new javax.swing.JButton();
Inventory = new
package projectf1; javax.swing.JButton();
jSeparator2 = new
javax.swing.JSeparator();
import java.awt.Desktop;
jSeparator1 = new
import java.net.URL; javax.swing.JSeparator();
import javax.swing.JFrame; Search = new
import javax.swing.JOptionPane; javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
public Main_Admin() {
initComponents();
setDefaultCloseOperation(javax.swing.Wi
} ndowConstants.EXIT_ON_CLOSE);
SalesOrderActionPerformed(evt); About.setText("About");
} About.addActionListener(new
java.awt.event.ActionListener() {
});
public void
actionPerformed(java.awt.event.ActionEve
Clients.setText("Clients"); nt evt) {
Clients.addActionListener(new AboutActionPerformed(evt);
java.awt.event.ActionListener() {
}
public void
});
actionPerformed(java.awt.event.ActionEve
nt evt) {
ClientsActionPerformed(evt); jButton1.setText("Website");
} jButton1.addActionListener(new
java.awt.event.ActionListener() {
});
public void
actionPerformed(java.awt.event.ActionEve
Inventory.setText("Inventory"); nt evt) {
Inventory.addActionListener(new jButton1ActionPerformed(evt);
java.awt.event.ActionListener() {
}
public void
});
actionPerformed(java.awt.event.ActionEve
nt evt) {
InventoryActionPerformed(evt); javax.swing.GroupLayout layout =
new
}
javax.swing.GroupLayout(getContentPane
}); ());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
jSeparator2.setOrientation(javax.swing.Sw
ingConstants.VERTICAL);
layout.createParallelGroup(javax.swing.Gr .addComponent(Inventory,
oupLayout.Alignment.LEADING) javax.swing.GroupLayout.DEFAULT_SIZE
,
javax.swing.GroupLayout.DEFAULT_SIZE
.addGroup(layout.createSequentialGroup(
, Short.MAX_VALUE)
)
.addComponent(Main,
.addGroup(layout.createParallelGroup(jav
javax.swing.GroupLayout.PREFERRED_
ax.swing.GroupLayout.Alignment.LEADIN
SIZE, 110,
G)
javax.swing.GroupLayout.PREFERRED_
SIZE)))
.addGroup(layout.createSequentialGroup(
)
.addGroup(layout.createSequentialGroup(
.addGap(23, 23, 23) )
.addContainerGap()
.addComponent(jSeparator1))
.addComponent(jLabel3)))
.addGroup(layout.createSequentialGroup(
)
.addPreferredGap(javax.swing.LayoutStyl
e.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(jav
ax.swing.GroupLayout.Alignment.LEADIN
.addComponent(jSeparator2,
G)
javax.swing.GroupLayout.PREFERRED_
SIZE, 66,
.addGroup(layout.createSequentialGroup( javax.swing.GroupLayout.PREFERRED_
) SIZE)
.addGroup(layout.createParallelGroup(jav
.addGroup(layout.createParallelGroup(jav
ax.swing.GroupLayout.Alignment.LEADIN
ax.swing.GroupLayout.Alignment.LEADIN
G)
G)
.addGroup(javax.swing.GroupLayout.Align
.addGroup(layout.createSequentialGroup(
ment.TRAILING,
)
layout.createSequentialGroup()
.addGap(94, 94, 94)
.addPreferredGap(javax.swing.LayoutStyl
.addComponent(jLabel2) e.ComponentPlacement.RELATED)
.addPreferredGap(javax.swing.LayoutStyl .addGroup(layout.createParallelGroup(jav
e.ComponentPlacement.RELATED, 780, ax.swing.GroupLayout.Alignment.LEADIN
Short.MAX_VALUE) G)
.addComponent(Search,
javax.swing.GroupLayout.PREFERRED_ .addGroup(layout.createSequentialGroup(
SIZE, 171, )
javax.swing.GroupLayout.PREFERRED_
SIZE)
.addComponent(jLabel3)
.addGap(250, 250, 250))
.addGap(18, 18, 18)
.addComponent(Main)
.addGroup(layout.createSequentialGroup(
) .addGap(18, 18, 18)
.addComponent(jLabel1)
.addComponent(SalesOrder)
.addContainerGap(javax.swing.GroupLay .addGap(18, 18, 18)
out.DEFAULT_SIZE,
Short.MAX_VALUE)))))
.addComponent(Clients)
);
.addGap(18, 18, 18)
layout.setVerticalGroup(
.addComponent(Inventory)
layout.createParallelGroup(javax.swing.Gr
.addGap(0, 322,
oupLayout.Alignment.LEADING)
Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup(
.addComponent(jSeparator2,
)
javax.swing.GroupLayout.DEFAULT_SIZE
.addGap(53, 53, 53) , 685, Short.MAX_VALUE))
.addContainerGap()) javax.swing.GroupLayout.PREFERRED_
SIZE)
.addGroup(layout.createSequentialGroup(
) .addComponent(jLabel2)))
.addGap(216, 216, 216) .addGap(35, 35, 35)
.addComponent(jLabel1)
.addGroup(layout.createParallelGroup(jav
.addContainerGap(698,
ax.swing.GroupLayout.Alignment.BASELI
Short.MAX_VALUE)))
NE)
);
.addComponent(About)
.addComponent(jButton1)) pack();
}// </editor-fold>
.addContainerGap(javax.swing.GroupLay
out.DEFAULT_SIZE,
Short.MAX_VALUE)))) private void
SalesOrderActionPerformed(java.awt.eve
.addGroup(layout.createParallelGroup(jav nt.ActionEvent evt) {
ax.swing.GroupLayout.Alignment.LEADIN JFrame frame = new
G) JFrame("JOptionPane
showMessageDialog example");
.addGroup(layout.createSequentialGroup(
) JOptionPane.showMessageDialog(frame,
.addGap(13, 13, 13) "Feature comming soon!!");
}
.addGroup(layout.createParallelGroup(jav
ax.swing.GroupLayout.Alignment.LEADIN
G) private void
ClientsActionPerformed(java.awt.event.Ac
.addComponent(Search, tionEvent evt) {
javax.swing.GroupLayout.PREFERRED_
SIZE, this.setVisible(false);
javax.swing.GroupLayout.DEFAULT_SIZE
new Clients().setVisible(true);
,
javax.swing.GroupLayout.PREFERRED_ }
SIZE)
e.printStackTrace(); break;
} }
} }
} catch (ClassNotFoundException ex)
{
private void
InventoryActionPerformed(java.awt.event.
ActionEvent evt) { java.util.logging.Logger.getLogger(Main_A
dmin.class.getName()).log(java.util.loggin
this.setVisible(false); g.Level.SEVERE, null, ex);
new Inventory().setVisible(true); } catch (InstantiationException ex) {
}
java.util.logging.Logger.getLogger(Main_A
dmin.class.getName()).log(java.util.loggin
/** g.Level.SEVERE, null, ex);
* @param args the command line } catch (IllegalAccessException ex) {
arguments
*/ java.util.logging.Logger.getLogger(Main_A
dmin.class.getName()).log(java.util.loggin
public static void main(String args[]) {
g.Level.SEVERE, null, ex);
System.out.print("hi");
} catch
//<editor-fold defaultstate="collapsed" (javax.swing.UnsupportedLookAndFeelEx
desc=" Look and feel setting code ception ex) {
(optional) ">
/* If Nimbus (introduced in Java SE java.util.logging.Logger.getLogger(Main_A
6) is not available, stay with the default dmin.class.getName()).log(java.util.loggin
look and feel. g.Level.SEVERE, null, ex);
Connection cn = null;
// Variables declaration - do not modify
ResultSet rs = null;
private javax.swing.JButton About;
Statement s = null;
private javax.swing.JButton Clients;
Search_Clients connE = new
private javax.swing.JButton Inventory;
Search_Clients();
private javax.swing.JButton Main;
public Clients() {
private javax.swing.JButton SalesOrder;
initComponents();
private javax.swing.JTextField Search;
}
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
@SuppressWarnings("unchecked")
private javax.swing.JLabel jLabel3;
// <editor-fold defaultstate="collapsed"
private javax.swing.JSeparator desc="Generated Code">
jSeparator1;
private void initComponents() {
private javax.swing.JSeparator
jSeparator2;
jLabel2 = new javax.swing.JLabel();
// End of variables declaration
jLabel1 = new javax.swing.JLabel();
}
Main = new javax.swing.JButton();
Clients.java
SalesOrder = new
package projectf1; javax.swing.JButton();
Clients = new javax.swing.JButton();
import java.sql.Connection; Inventory = new
javax.swing.JButton();
import java.sql.DriverManager;
jSeparator2 = new
import java.sql.PreparedStatement;
javax.swing.JSeparator();
import java.sql.ResultSet;
jSeparator1 = new });
javax.swing.JSeparator();
Create = new javax.swing.JButton();
SalesOrder.setText("Sales Order");
jScrollPane1 = new
SalesOrder.addActionListener(new
javax.swing.JScrollPane();
java.awt.event.ActionListener() {
Clientable = new
public void
javax.swing.JTable();
actionPerformed(java.awt.event.ActionEve
Edit = new javax.swing.JButton(); nt evt) {
jLabel3 = new javax.swing.JLabel();
SalesOrderActionPerformed(evt);
jLabel4 = new javax.swing.JLabel();
}
jLabel5 = new javax.swing.JLabel();
});
Search2 = new
javax.swing.JTextField();
Go_Clients = new Clients.setText("Clients");
javax.swing.JButton();
Clients.setEnabled(false);
Edit_Client = new
Clients.addActionListener(new
javax.swing.JButton();
java.awt.event.ActionListener() {
Delete = new javax.swing.JButton();
public void
actionPerformed(java.awt.event.ActionEve
nt evt) {
setDefaultCloseOperation(javax.swing.Wi ClientsActionPerformed(evt);
ndowConstants.EXIT_ON_CLOSE);
}
setTitle("Clients");
});
jLabel2.setFont(new
Inventory.setText("Inventory");
java.awt.Font("Tahoma", 1, 14)); //
NOI18N Inventory.addActionListener(new
java.awt.event.ActionListener() {
jLabel2.setText("Clients");
public void
actionPerformed(java.awt.event.ActionEve
Main.setText("Main Page"); nt evt) {
Main.addActionListener(new InventoryActionPerformed(evt);
java.awt.event.ActionListener() {
}
public void
});
actionPerformed(java.awt.event.ActionEve
nt evt) {
MainActionPerformed(evt);
jSeparator2.setOrientation(javax.swing.Sw
}
ingConstants.VERTICAL);
jLabel4.setIcon(new
javax.swing.ImageIcon(getClass().getRes
Create.setText("Create");
ource("/projectf1/logo.jpg"))); // NOI18N
Create.addActionListener(new
java.awt.event.ActionListener() {
jLabel5.setText("Search Clients: ");
public void
actionPerformed(java.awt.event.ActionEve
nt evt) {
Search2.addActionListener(new
CreateActionPerformed(evt); java.awt.event.ActionListener() {
} public void
actionPerformed(java.awt.event.ActionEve
});
nt evt) {
Search2ActionPerformed(evt);
Clientable.setModel(new
}
javax.swing.table.DefaultTableModel(
});
new Object [][] {
Go_Clients.setText("Go");
},
Go_Clients.addActionListener(new
new String [] {
java.awt.event.ActionListener() {
"Account Number", "Client
public void
Name", "Address", "Phone Number",
actionPerformed(java.awt.event.ActionEve
"Email Adress"
nt evt) {
}
)); Go_ClientsActionPerformed(evt);
}
jScrollPane1.setViewportView(Clientable);
});
Edit.setText("Refresh");
Edit_Client.setText("Edit");
Edit.addActionListener(new
Edit_Client.addActionListener(new
java.awt.event.ActionListener() {
java.awt.event.ActionListener() {
public void
public void
actionPerformed(java.awt.event.ActionEve
actionPerformed(java.awt.event.ActionEve
nt evt) {
nt evt) {
EditActionPerformed(evt);
} Edit_ClientActionPerformed(evt);
}); }
});
Delete.setText("Delete");
.addGroup(layout.createSequentialGroup(
Delete.addActionListener(new
)
java.awt.event.ActionListener() {
.addGap(46, 46, 46)
public void
actionPerformed(java.awt.event.ActionEve
nt evt) { .addComponent(jLabel3))
DeleteActionPerformed(evt);
.addGroup(layout.createSequentialGroup(
}
)
});
.addContainerGap()
layout.createParallelGroup(javax.swing.Gr .addGroup(layout.createParallelGroup(jav
oupLayout.Alignment.LEADING) ax.swing.GroupLayout.Alignment.LEADIN
G, false)
.addGroup(layout.createSequentialGroup(
) .addComponent(Clients,
javax.swing.GroupLayout.DEFAULT_SIZE
,
.addGroup(layout.createParallelGroup(jav javax.swing.GroupLayout.DEFAULT_SIZE
ax.swing.GroupLayout.Alignment.LEADIN , Short.MAX_VALUE)
G)
.addComponent(SalesOrder,
.addGroup(javax.swing.GroupLayout.Align javax.swing.GroupLayout.DEFAULT_SIZE
ment.TRAILING, ,
layout.createSequentialGroup() javax.swing.GroupLayout.DEFAULT_SIZE
.addContainerGap() , Short.MAX_VALUE)
.addComponent(jSeparator1)) .addComponent(Inventory,
javax.swing.GroupLayout.DEFAULT_SIZE
,
.addGroup(layout.createSequentialGroup( javax.swing.GroupLayout.DEFAULT_SIZE
) , Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(jav .addComponent(Main,
ax.swing.GroupLayout.Alignment.LEADIN javax.swing.GroupLayout.PREFERRED_
G) SIZE, 110,
javax.swing.GroupLayout.PREFERRED_ .addGap(18, 18, 18)
SIZE))))
.addComponent(Delete,
.addPreferredGap(javax.swing.LayoutStyl javax.swing.GroupLayout.PREFERRED_
e.ComponentPlacement.UNRELATED) SIZE, 80,
javax.swing.GroupLayout.PREFERRED_
SIZE)))
.addComponent(jSeparator2,
javax.swing.GroupLayout.PREFERRED_ .addGap(0, 120,
SIZE, 66, Short.MAX_VALUE)))
javax.swing.GroupLayout.PREFERRED_
.addContainerGap())
SIZE)
.addGap(185, 185, 185)
.addGroup(javax.swing.GroupLayout.Align
ment.TRAILING,
.addGroup(layout.createParallelGroup(jav layout.createSequentialGroup()
ax.swing.GroupLayout.Alignment.LEADIN
.addGap(0, 0,
G)
Short.MAX_VALUE)
.addComponent(jLabel5)
.addComponent(jScrollPane1,
javax.swing.GroupLayout.PREFERRED_
SIZE, 647, .addPreferredGap(javax.swing.LayoutStyl
javax.swing.GroupLayout.PREFERRED_ e.ComponentPlacement.RELATED)
SIZE)
.addComponent(Search2,
javax.swing.GroupLayout.PREFERRED_
.addGroup(layout.createSequentialGroup( SIZE, 130,
) javax.swing.GroupLayout.PREFERRED_
SIZE)
.addComponent(Create, .addGap(18, 18, 18)
javax.swing.GroupLayout.PREFERRED_
SIZE, 83, .addComponent(Go_Clients)
javax.swing.GroupLayout.PREFERRED_ .addGap(138, 138, 138))
SIZE)
.addGap(18, 18, 18) .addGroup(layout.createParallelGroup(jav
.addComponent(Edit, ax.swing.GroupLayout.Alignment.LEADIN
javax.swing.GroupLayout.PREFERRED_ G)
SIZE, 84,
javax.swing.GroupLayout.PREFERRED_ .addGroup(javax.swing.GroupLayout.Align
SIZE) ment.TRAILING,
.addGap(18, 18, 18) layout.createSequentialGroup()
.addGap(104, 104, 104)
.addComponent(Edit_Client, .addComponent(jLabel2)
javax.swing.GroupLayout.PREFERRED_
SIZE, 70, .addGap(1216, 1216, 1216))
javax.swing.GroupLayout.PREFERRED_
SIZE)
.addGroup(layout.createSequentialGroup( .addGroup(layout.createParallelGroup(jav
) ax.swing.GroupLayout.Alignment.LEADIN
G)
.addGap(10, 10, 10)
.addComponent(jLabel1)
.addGroup(layout.createSequentialGroup(
.addContainerGap(1367, )
Short.MAX_VALUE)))
); .addGroup(layout.createParallelGroup(jav
ax.swing.GroupLayout.Alignment.BASELI
layout.setVerticalGroup( NE)
.addComponent(Create)
layout.createParallelGroup(javax.swing.Gr
oupLayout.Alignment.LEADING) .addComponent(Edit)
.addComponent(jLabel3)
.addGroup(layout.createSequentialGroup(
)
.addComponent(Edit_Client)
.addGap(14, 14, 14)
.addComponent(Delete))
.addGroup(layout.createParallelGroup(jav
.addPreferredGap(javax.swing.LayoutStyl
ax.swing.GroupLayout.Alignment.BASELI
e.ComponentPlacement.RELATED)
NE)
.addComponent(jLabel5)
.addGroup(layout.createParallelGroup(jav
.addComponent(Search2, ax.swing.GroupLayout.Alignment.LEADIN
javax.swing.GroupLayout.PREFERRED_ G)
SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE
.addComponent(jScrollPane1,
,
javax.swing.GroupLayout.PREFERRED_
javax.swing.GroupLayout.PREFERRED_
SIZE,
SIZE)
javax.swing.GroupLayout.DEFAULT_SIZE
.addComponent(Go_Clients)) ,
javax.swing.GroupLayout.PREFERRED_
SIZE)
.addPreferredGap(javax.swing.LayoutStyl
e.ComponentPlacement.RELATED)
.addGroup(layout.createSequentialGroup(
.addComponent(jSeparator1, )
javax.swing.GroupLayout.PREFERRED_
SIZE, 10,
javax.swing.GroupLayout.PREFERRED_ .addComponent(jLabel4)
SIZE)
.addGap(38, 38, 38)
.addComponent(Main)
.addPreferredGap(javax.swing.LayoutStyl
e.ComponentPlacement.RELATED) .addGap(18, 18, 18)
// TODO add your handling code
.addComponent(SalesOrder) here:
.addGap(18, 18, 18) }
.addComponent(Clients)
private void
.addGap(18, 18, 18) MainActionPerformed(java.awt.event.Actio
nEvent evt) {
.addComponent(Inventory))) this.setVisible(false);
.addGap(0, 0, new Main_Admin().setVisible(true);
Short.MAX_VALUE))
}
.addComponent(jSeparator2,
javax.swing.GroupLayout.Alignment.TRAI
LING, private void
javax.swing.GroupLayout.DEFAULT_SIZE SalesOrderActionPerformed(java.awt.eve
, 696, Short.MAX_VALUE)) nt.ActionEvent evt) {
.addContainerGap()) JFrame frame = new
JFrame("JOptionPane
showMessageDialog example");
.addGroup(layout.createParallelGroup(jav
ax.swing.GroupLayout.Alignment.LEADIN
G) JOptionPane.showMessageDialog(frame,
"Feature comming soon!!");
.addGroup(layout.createSequentialGroup( }
)
.addGap(16, 16, 16)
private void
.addComponent(jLabel2) InventoryActionPerformed(java.awt.event.
ActionEvent evt) {
.addGap(34, 34, 34)
this.setVisible(false);
.addComponent(jLabel1)
new Inventory().setVisible(true);
.addContainerGap(702,
Short.MAX_VALUE))) }
);
private void
CreateActionPerformed(java.awt.event.Ac
pack();
tionEvent evt) {
}// </editor-fold>
this.setVisible(false);
new
private void New_ClientGUI().setVisible(true);
ClientsActionPerformed(java.awt.event.Ac
}
tionEvent evt) {
private void }
EditActionPerformed(java.awt.event.Actio
nEvent evt) {
private void
try {
DeleteActionPerformed(java.awt.event.Act
Connection ionEvent evt) {
conn=DriverManager.getConnection("jdbc
String Input =
:ucanaccess://C:\\Users\\Noel
JOptionPane.showInputDialog("Enter
Portillo\\Desktop\\Final Project.accdb");
Control Number: ");
String sql="select
try {
Account_Number,Client_Name,Address,P
hone_Number,Email_Address from
Clients"; Class.forName("net.ucanaccess.jdbc.Uca
naccessDriver");
PreparedStatement
pst=conn.prepareStatement(sql); cn =
DriverManager.getConnection("jdbc:ucana
ResultSet
ccess://C:\\Users\\Noel
rs=pst.executeQuery();
Portillo\\Desktop//Final Project.accdb");
String sql = "Delete from Clients
Clientable.setModel(DbUtils.resultSetToT
where Account_Number = '"+Input+"' ";
ableModel(rs));
s = cn.createStatement();
}
s.executeUpdate(sql);
catch(Exception ex)
{
JOptionPane.showMessageDialog(null, }
ex);
catch (Exception ex) {
}
} JOptionPane.showMessageDialog(null,
ex);
}
private void
Search2ActionPerformed(java.awt.event.A }
ctionEvent evt) {
// TODO add your handling code
here: private void
Edit_ClientActionPerformed(java.awt.even
} t.ActionEvent evt) {
this.setVisible(false);
private void new Edit_ClientGUI().setVisible(true);
Go_ClientsActionPerformed(java.awt.even
t.ActionEvent evt) { }
connE.Search_Clients(Search2.getText());
/** class.getName()).log(java.util.logging.Lev
el.SEVERE, null, ex);
* @param args the command line
arguments } catch (IllegalAccessException ex) {
*/
java.util.logging.Logger.getLogger(Clients.
public static void main(String args[]) {
class.getName()).log(java.util.logging.Lev
System.out.print("hi"); el.SEVERE, null, ex);
setDefaultCloseOperation(javax.swing.Wi
Connection cn = null; ndowConstants.EXIT_ON_CLOSE);
ResultSet rs = null; setTitle("New Client");
Statement s = null;
jLabel4.setFont(new javax.swing.GroupLayout layout =
java.awt.Font("Tahoma", 1, 36)); // new
NOI18N javax.swing.GroupLayout(getContentPane
());
jLabel4.setText("NEW CLIENT");
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
jLabel1.setText("Account Number:");
layout.createParallelGroup(javax.swing.Gr
jLabel2.setText("Full Name:"); oupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup(
jLabel3.setText("Address:"); )
Submit.setText("Submit"); .addGroup(layout.createParallelGroup(jav
ax.swing.GroupLayout.Alignment.TRAILIN
Submit.addActionListener(new G)
java.awt.event.ActionListener() {
.addComponent(jLabel4,
public void javax.swing.GroupLayout.PREFERRED_
actionPerformed(java.awt.event.ActionEve SIZE, 242,
nt evt) { javax.swing.GroupLayout.PREFERRED_
SIZE)
SubmitActionPerformed(evt);
}
.addGroup(layout.createParallelGroup(jav
}); ax.swing.GroupLayout.Alignment.LEADIN
G)
Cancel.setText("Cancel"); .addGroup(layout.createSequentialGroup(
Cancel.addActionListener(new )
java.awt.event.ActionListener() { .addGap(119, 119, 119)
public void
actionPerformed(java.awt.event.ActionEve .addComponent(Submit))
nt evt) {
CancelActionPerformed(evt); .addGroup(layout.createSequentialGroup(
} )
.addGroup(layout.createParallelGroup(jav
jLabel5.setText("Phone Number:"); ax.swing.GroupLayout.Alignment.TRAILIN
G)
jLabel6.setText("Email Address:");
.addComponent(Cancel)
.addGroup(layout.createSequentialGroup( layout.createParallelGroup(javax.swing.Gr
) oupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(jav .addGroup(javax.swing.GroupLayout.Align
ax.swing.GroupLayout.Alignment.TRAILIN ment.TRAILING,
G) layout.createSequentialGroup()
.addGap(22, 22, 22)
.addComponent(jLabel3)
.addComponent(jLabel4,
javax.swing.GroupLayout.PREFERRED_
.addComponent(jLabel2) SIZE, 73,
javax.swing.GroupLayout.PREFERRED_
SIZE)
.addComponent(jLabel1)
.addGap(18, 18, 18)
.addComponent(jLabel5)
.addGroup(layout.createParallelGroup(jav
ax.swing.GroupLayout.Alignment.BASELI
.addComponent(jLabel6))
NE)
.addGap(18, 18,
.addComponent(jLabel1)
18)
.addComponent(Account,
javax.swing.GroupLayout.PREFERRED_
.addGroup(layout.createParallelGroup(jav
SIZE,
ax.swing.GroupLayout.Alignment.LEADIN
javax.swing.GroupLayout.DEFAULT_SIZE
G, false)
,
javax.swing.GroupLayout.PREFERRED_
.addComponent(Name) SIZE))
.addGap(18, 18, 18)
.addComponent(Address,
javax.swing.GroupLayout.DEFAULT_SIZE
.addGroup(layout.createParallelGroup(jav
, 111, Short.MAX_VALUE)
ax.swing.GroupLayout.Alignment.BASELI
NE)
.addComponent(Account)
.addComponent(jLabel2)
.addComponent(Name,
.addComponent(Phone)
javax.swing.GroupLayout.PREFERRED_
SIZE,
.addComponent(Email))))))) javax.swing.GroupLayout.DEFAULT_SIZE
,
.addContainerGap(88, javax.swing.GroupLayout.PREFERRED_
Short.MAX_VALUE)) SIZE))
); .addGap(18, 18, 18)
layout.setVerticalGroup(
.addGroup(layout.createParallelGroup(jav
ax.swing.GroupLayout.Alignment.LEADIN .addComponent(Submit)
G)
.addComponent(Cancel))
.addComponent(jLabel3)
.addGap(51, 51, 51))
.addComponent(Address,
);
javax.swing.GroupLayout.PREFERRED_
SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE
, pack();
javax.swing.GroupLayout.PREFERRED_ }// </editor-fold>
SIZE))
.addGap(20, 20, 20)
private void
SubmitActionPerformed(java.awt.event.Ac
.addGroup(layout.createParallelGroup(jav tionEvent evt) {
ax.swing.GroupLayout.Alignment.BASELI
NE) try {
.addComponent(jLabel5)
.addComponent(Phone, String str = Name.getText();
javax.swing.GroupLayout.PREFERRED_
String str1 = Address.getText();
SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE String str2 = Phone.getText();
,
javax.swing.GroupLayout.PREFERRED_ String str3 = Email.getText();
SIZE)) String str4 = Account.getText();
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(jav Class.forName("net.ucanaccess.jdbc.Uca
ax.swing.GroupLayout.Alignment.BASELI naccessDriver");
NE)
Connection cn =
.addComponent(Email, DriverManager.getConnection("jdbc:ucana
javax.swing.GroupLayout.PREFERRED_ ccess://C:\\Users\\Noel
SIZE, Portillo\\Desktop\\Final Project.accdb");
javax.swing.GroupLayout.DEFAULT_SIZE
, String sql = "insert into Clients
javax.swing.GroupLayout.PREFERRED_ (Account_Number, Client_Name,
SIZE) Address, Phone_Number, Email_Address)
values ('"+str4+"', '"+str+"', '"+str1+"',
.addComponent(jLabel6)) '"+str2+"', '"+str3+"')";
s = cn.createStatement();
.addPreferredGap(javax.swing.LayoutStyl
e.ComponentPlacement.RELATED, 33, s.executeUpdate(sql);
Short.MAX_VALUE)
java.util.logging.Logger.getLogger(New_C
/** lientGUI.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
* @param args the command line
arguments } catch (IllegalAccessException ex) {
*/
java.util.logging.Logger.getLogger(New_C
public static void main(String args[]) { lientGUI.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
/* Set the Nimbus look and feel */
} catch
//<editor-fold defaultstate="collapsed"
(javax.swing.UnsupportedLookAndFeelEx
desc=" Look and feel setting code
ception ex) {
(optional) ">
/* If Nimbus (introduced in Java SE
java.util.logging.Logger.getLogger(New_C
6) is not available, stay with the default
lientGUI.class.getName()).log(java.util.log
look and feel.
ging.Level.SEVERE, null, ex);
* For details see
}
http://download.oracle.com/javase/tutorial/
uiswing/lookandfeel/plaf.html //</editor-fold>
*/
try { /* Create and display the form */
for
(javax.swing.UIManager.LookAndFeelInfo
import java.sql.Statement;
java.awt.EventQueue.invokeLater(new
Runnable() {
public void run() {
public class Edit_ClientGUI extends
new
javax.swing.JFrame {
New_ClientGUI().setVisible(true);
}
Connection cn = null;
});
ResultSet rs = null;
}
Statement state = null;
jLabel4.setFont(new
setDefaultCloseOperation(javax.swing.Wi
java.awt.Font("Tahoma", 1, 36)); //
ndowConstants.EXIT_ON_CLOSE);
NOI18N
setTitle("Edit Client");
jLabel4.setText("EDIT CLIENT");
Cancel.setText("Cancel");
javax.swing.GroupLayout layout =
Cancel.addActionListener(new new
java.awt.event.ActionListener() { javax.swing.GroupLayout(getContentPane
());
public void
actionPerformed(java.awt.event.ActionEve getContentPane().setLayout(layout);
nt evt) {
layout.setHorizontalGroup(
CancelActionPerformed(evt);
} layout.createParallelGroup(javax.swing.Gr
oupLayout.Alignment.LEADING)
});
.addGroup(layout.createSequentialGroup(
Submit.setText("Submit"); )
Submit.addActionListener(new
java.awt.event.ActionListener() { .addGroup(layout.createParallelGroup(jav
ax.swing.GroupLayout.Alignment.TRAILIN
public void G)
actionPerformed(java.awt.event.ActionEve
nt evt) { .addComponent(jLabel4,
javax.swing.GroupLayout.PREFERRED_
SubmitActionPerformed(evt); SIZE, 242,
} javax.swing.GroupLayout.PREFERRED_
SIZE)
});
.addGroup(layout.createParallelGroup(jav
ax.swing.GroupLayout.Alignment.LEADIN
jLabel6.setText("Email Address:");
G)
.addGroup(layout.createSequentialGroup( .addComponent(Phone)
)
.addGap(100, 100, 100) .addComponent(Email)))))))
.addContainerGap(88,
.addGroup(layout.createParallelGroup(jav Short.MAX_VALUE))
ax.swing.GroupLayout.Alignment.TRAILIN
);
G)
layout.setVerticalGroup(
.addComponent(Cancel)
layout.createParallelGroup(javax.swing.Gr
oupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup(
)
.addGroup(javax.swing.GroupLayout.Align
ment.TRAILING,
.addGroup(layout.createParallelGroup(jav
layout.createSequentialGroup()
ax.swing.GroupLayout.Alignment.TRAILIN
G) .addGap(22, 22, 22)
.addComponent(jLabel4,
.addComponent(jLabel3) javax.swing.GroupLayout.PREFERRED_
SIZE, 73,
javax.swing.GroupLayout.PREFERRED_
.addComponent(jLabel2)
SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel1)
.addGroup(layout.createParallelGroup(jav
.addComponent(jLabel5)
ax.swing.GroupLayout.Alignment.BASELI
NE)
.addComponent(jLabel6))
.addComponent(jLabel1)
.addGap(18, 18,
.addComponent(Account,
18)
javax.swing.GroupLayout.PREFERRED_
SIZE,
.addGroup(layout.createParallelGroup(jav javax.swing.GroupLayout.DEFAULT_SIZE
ax.swing.GroupLayout.Alignment.LEADIN ,
G, false) javax.swing.GroupLayout.PREFERRED_
SIZE))
.addComponent(Name) .addGap(18, 18, 18)
.addComponent(Address, .addGroup(layout.createParallelGroup(jav
javax.swing.GroupLayout.DEFAULT_SIZE ax.swing.GroupLayout.Alignment.BASELI
, 111, Short.MAX_VALUE) NE)
.addComponent(jLabel2) javax.swing.GroupLayout.PREFERRED_
SIZE)
.addComponent(Name,
javax.swing.GroupLayout.PREFERRED_ .addComponent(jLabel6))
SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE
.addPreferredGap(javax.swing.LayoutStyl
,
e.ComponentPlacement.RELATED, 32,
javax.swing.GroupLayout.PREFERRED_
Short.MAX_VALUE)
SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(jav
ax.swing.GroupLayout.Alignment.BASELI
.addGroup(layout.createParallelGroup(jav NE)
ax.swing.GroupLayout.Alignment.LEADIN
.addComponent(Submit)
G)
.addComponent(Cancel))
.addComponent(jLabel3)
.addGap(51, 51, 51))
.addComponent(Address,
javax.swing.GroupLayout.PREFERRED_ );
SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE
, pack();
javax.swing.GroupLayout.PREFERRED_
SIZE)) }// </editor-fold>
}
javax.swing.UIManager.setLookAndFeel(i
catch (Exception ex) { nfo.getClassName());
System.out.println(ex); break;
} }
setVisible(false); }
form.setVisible(false);
java.util.logging.Logger.getLogger(Edit_Cli
new Clients().setVisible(true); entGUI.class.getName()).log(java.util.loggi
ng.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(Edit_Cli
/** entGUI.class.getName()).log(java.util.loggi
ng.Level.SEVERE, null, ex);
* @param args the command line
arguments } catch (IllegalAccessException ex) {
*/
java.util.logging.Logger.getLogger(Edit_Cli
public static void main(String args[]) {
entGUI.class.getName()).log(java.util.loggi
/* Set the Nimbus look and feel */ ng.Level.SEVERE, null, ex);
} catch // End of variables declaration
(javax.swing.UnsupportedLookAndFeelEx
}
ception ex) {
Search_Clients.java
java.util.logging.Logger.getLogger(Edit_Cli
entGUI.class.getName()).log(java.util.loggi package projectf1;
ng.Level.SEVERE, null, ex);
} import java.sql.Connection;
//</editor-fold> import java.sql.DriverManager;
import java.sql.PreparedStatement;
/* Create and display the form */ import java.sql.ResultSet;
import javax.swing.JOptionPane;
java.awt.EventQueue.invokeLater(new
Runnable() { import java.lang.String;
});
} private Connection conn;
public Statement stmt;
catch(Exception ex)
Back.setText("Back");
{
Back.addActionListener(new
ex.printStackTrace();
java.awt.event.ActionListener() {
System.out.print(ex.toString());
public void
} actionPerformed(java.awt.event.ActionEve
nt evt) {
}
BackActionPerformed(evt);
}
});
/**
* This method is called from within the
constructor to initialize the form. tblSearch_Clients.setModel(new
javax.swing.table.DefaultTableModel(
* WARNING: Do NOT modify this
code. The content of this method is new Object [][] {
always
* regenerated by the Form Editor.
},
*/
new String [] {
@SuppressWarnings("unchecked")
"Account Number", "Client
// <editor-fold defaultstate="collapsed" Name", "Address", "Phone Number",
desc="Generated Code"> "Email Address"
private void initComponents() { }
));
jScrollPane1.setViewportView(tblSearch_ .addGroup(layout.createSequentialGroup(
Clients); )
.addContainerGap()
javax.swing.GroupLayout layout =
new .addGroup(layout.createParallelGroup(jav
javax.swing.GroupLayout(getContentPane ax.swing.GroupLayout.Alignment.LEADIN
()); G)
getContentPane().setLayout(layout); .addComponent(jLabel1)
layout.setHorizontalGroup( .addComponent(Back))
.addGap(18, 18, 18)
layout.createParallelGroup(javax.swing.Gr
.addComponent(jScrollPane1,
oupLayout.Alignment.LEADING)
javax.swing.GroupLayout.PREFERRED_
SIZE, 305,
.addGroup(layout.createSequentialGroup( javax.swing.GroupLayout.PREFERRED_
) SIZE)
.addContainerGap()
.addContainerGap(javax.swing.GroupLay
out.DEFAULT_SIZE,
.addGroup(layout.createParallelGroup(jav
Short.MAX_VALUE))
ax.swing.GroupLayout.Alignment.LEADIN
G) );
.addComponent(jScrollPane1,
pack();
javax.swing.GroupLayout.DEFAULT_SIZE
, 607, Short.MAX_VALUE) }// </editor-fold>
.addGroup(layout.createSequentialGroup(
) private void
BackActionPerformed(java.awt.event.Acti
.addComponent(jLabel1) onEvent evt) {
this.setVisible(false);
.addPreferredGap(javax.swing.LayoutStyl
e.ComponentPlacement.RELATED, new Clients().setVisible(true);
javax.swing.GroupLayout.DEFAULT_SIZE }
, Short.MAX_VALUE)
.addComponent(Back)))
/**
.addContainerGap())
* @param args the command line
); arguments
layout.setVerticalGroup( */
public static void main(String args[]) {
layout.createParallelGroup(javax.swing.Gr
oupLayout.Alignment.LEADING) /* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" } catch
desc=" Look and feel setting code (javax.swing.UnsupportedLookAndFeelEx
(optional) "> ception ex) {
/* If Nimbus (introduced in Java SE
6) is not available, stay with the default java.util.logging.Logger.getLogger(Search
look and feel. _Clients.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
* For details see
http://download.oracle.com/javase/tutorial/ }
uiswing/lookandfeel/plaf.html
//</editor-fold>
*/
try {
/* Create and display the form */
for
}
(javax.swing.UIManager.LookAndFeelInfo
info :
javax.swing.UIManager.getInstalledLookA
ndFeels()) { // Variables declaration - do not modify
jScrollPane1.setViewportView(Clientable);
public void
actionPerformed(java.awt.event.ActionEve
Edit1.setText("Edit");
nt evt) {
Edit1.addActionListener(new
Search1ActionPerformed(evt);
java.awt.event.ActionListener() {
}
public void
actionPerformed(java.awt.event.ActionEve });
nt evt) {
Edit1ActionPerformed(evt);
Go.setText("Go");
}
Go.addActionListener(new
}); java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEve
Report.setText("Out of Stock Items");
nt evt) {
Report.addActionListener(new
GoActionPerformed(evt);
java.awt.event.ActionListener() {
}
public void
actionPerformed(java.awt.event.ActionEve });
nt evt) {
ReportActionPerformed(evt);
jButton1.setText("Over Stock Items");
}
jButton1.addActionListener(new
}); java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEve
Delete.setText("Delete");
nt evt) {
Delete.addActionListener(new
jButton1ActionPerformed(evt);
java.awt.event.ActionListener() {
}
public void
actionPerformed(java.awt.event.ActionEve });
nt evt) {
DeleteActionPerformed(evt);
javax.swing.GroupLayout layout =
} new
javax.swing.GroupLayout(getContentPane
});
());
getContentPane().setLayout(layout);
jLabel1.setText("Search Inventory: ");
layout.setHorizontalGroup(
Search1.addActionListener(new layout.createParallelGroup(javax.swing.Gr
java.awt.event.ActionListener() { oupLayout.Alignment.LEADING)
SIZE, 110,
.addGroup(layout.createSequentialGroup( javax.swing.GroupLayout.PREFERRED_
) SIZE)))
.addContainerGap()
.addGroup(layout.createSequentialGroup(
)
.addGroup(layout.createParallelGroup(jav
ax.swing.GroupLayout.Alignment.LEADIN .addGap(10, 10, 10)
G)
.addComponent(jLabel4)))
.addGroup(layout.createSequentialGroup(
.addGap(18, 18, 18)
)
.addComponent(jSeparator2,
.addGroup(layout.createParallelGroup(jav
javax.swing.GroupLayout.PREFERRED_
ax.swing.GroupLayout.Alignment.LEADIN
SIZE, 66,
G)
javax.swing.GroupLayout.PREFERRED_
SIZE)
.addGroup(layout.createSequentialGroup(
.addGap(190, 190, 190)
)
.addGap(99, 99, 99)
.addGroup(layout.createParallelGroup(jav
ax.swing.GroupLayout.Alignment.LEADIN
.addGroup(layout.createParallelGroup(jav G)
ax.swing.GroupLayout.Alignment.LEADIN
G)
.addGroup(layout.createSequentialGroup(
)
.addComponent(Clients,
.addComponent(Add,
javax.swing.GroupLayout.PREFERRED_
javax.swing.GroupLayout.PREFERRED_
SIZE, 110,
SIZE, 83,
javax.swing.GroupLayout.PREFERRED_
javax.swing.GroupLayout.PREFERRED_
SIZE)
SIZE)
.addGap(18, 18, 18)
.addComponent(SalesOrder,
javax.swing.GroupLayout.PREFERRED_
SIZE, 110, .addComponent(Edit1,
javax.swing.GroupLayout.PREFERRED_ javax.swing.GroupLayout.PREFERRED_
SIZE) SIZE, 83,
javax.swing.GroupLayout.PREFERRED_
SIZE)
.addComponent(Main,
javax.swing.GroupLayout.PREFERRED_ .addGap(18, 18, 18)
SIZE, 110,
javax.swing.GroupLayout.PREFERRED_ .addComponent(Edit,
SIZE) javax.swing.GroupLayout.PREFERRED_
SIZE, 84,
javax.swing.GroupLayout.PREFERRED_
.addComponent(Inventory, SIZE)
javax.swing.GroupLayout.PREFERRED_
.addGap(18, 18, 18) .addComponent(Search1,
javax.swing.GroupLayout.PREFERRED_
SIZE, 130,
.addComponent(Delete))
javax.swing.GroupLayout.PREFERRED_
SIZE)
.addComponent(jScrollPane1,
.addGap(18, 18, 18)
javax.swing.GroupLayout.PREFERRED_
SIZE, 647, .addComponent(Go)
javax.swing.GroupLayout.PREFERRED_
.addGap(147, 147, 147))
SIZE)
);
.addGroup(layout.createSequentialGroup( layout.setVerticalGroup(
)
layout.createParallelGroup(javax.swing.Gr
.addComponent(Report) oupLayout.Alignment.LEADING)
.addGap(18, 18, 18)
.addGroup(layout.createSequentialGroup(
)
.addComponent(jButton1))))
.addComponent(jSeparator1,
.addGroup(layout.createParallelGroup(jav
javax.swing.GroupLayout.PREFERRED_
ax.swing.GroupLayout.Alignment.LEADIN
SIZE, 1357,
G)
javax.swing.GroupLayout.PREFERRED_
SIZE))
.addGroup(layout.createSequentialGroup(
)
.addContainerGap(javax.swing.GroupLay
out.DEFAULT_SIZE, .addGap(12, 12, 12)
Short.MAX_VALUE))
.addGroup(layout.createParallelGroup(jav
.addGroup(javax.swing.GroupLayout.Align ax.swing.GroupLayout.Alignment.BASELI
ment.TRAILING, NE)
layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(104, 104, 104)
.addComponent(jLabel2) .addComponent(Search1,
javax.swing.GroupLayout.PREFERRED_
SIZE,
.addPreferredGap(javax.swing.LayoutStyl
javax.swing.GroupLayout.DEFAULT_SIZE
e.ComponentPlacement.RELATED,
,
javax.swing.GroupLayout.DEFAULT_SIZE
javax.swing.GroupLayout.PREFERRED_
, Short.MAX_VALUE)
SIZE)
.addComponent(jLabel1)
.addComponent(Go)))
.addPreferredGap(javax.swing.LayoutStyl
.addGroup(layout.createSequentialGroup(
e.ComponentPlacement.RELATED)
)
.addGap(26, 26, 26)
.addGroup(javax.swing.GroupLayout.Align
.addComponent(jLabel2)))
ment.TRAILING,
.addGap(28, 28, 28) layout.createSequentialGroup()
.addComponent(jSeparator1,
javax.swing.GroupLayout.PREFERRED_ .addPreferredGap(javax.swing.LayoutStyl
SIZE, 10, e.ComponentPlacement.RELATED)
javax.swing.GroupLayout.PREFERRED_
SIZE)
.addGroup(layout.createParallelGroup(jav
ax.swing.GroupLayout.Alignment.LEADIN
.addGroup(layout.createParallelGroup(jav G)
ax.swing.GroupLayout.Alignment.LEADIN
G)
.addGroup(layout.createSequentialGroup(
)
.addGroup(layout.createSequentialGroup(
)
.addComponent(jLabel4)
.addGap(54, 54, 54)
.addGap(50, 50, 50)
.addComponent(Main)
.addGroup(layout.createParallelGroup(jav
ax.swing.GroupLayout.Alignment.BASELI .addGap(18, 18, 18)
NE)
.addComponent(Add) .addComponent(SalesOrder)
.addComponent(Edit) .addGap(18, 18, 18)
.addComponent(Edit1)
.addComponent(Clients)
.addComponent(Delete))
.addGap(18, 18, 18)
.addGap(18, 18, 18)
.addComponent(Inventory))
.addComponent(jScrollPane1,
javax.swing.GroupLayout.PREFERRED_
SIZE, 427, .addComponent(jSeparator2,
javax.swing.GroupLayout.PREFERRED_ javax.swing.GroupLayout.PREFERRED_
SIZE) SIZE, 696,
javax.swing.GroupLayout.PREFERRED_
.addGap(18, 18, 18)
SIZE))))
.addGroup(layout.createParallelGroup(jav
.addContainerGap(javax.swing.GroupLay
ax.swing.GroupLayout.Alignment.BASELI
out.DEFAULT_SIZE,
NE)
Short.MAX_VALUE))
.addComponent(Report)
);
.addComponent(jButton1)))
pack();
}// </editor-fold> new Add_ItemGUI().setVisible(true);
}
private void
MainActionPerformed(java.awt.event.Actio
private void
nEvent evt) {
EditActionPerformed(java.awt.event.Actio
this.setVisible(false); nEvent evt) {
new Main_Admin().setVisible(true); try {
} Connection
conn=DriverManager.getConnection("jdbc
:ucanaccess://C:\\Users\\Noel
private void Portillo\\Desktop\\Final Project.accdb");
SalesOrderActionPerformed(java.awt.eve
String sql="select
nt.ActionEvent evt) {
Control_Number,Brand,Stocks from
JFrame frame = new Products";
JFrame("JOptionPane
PreparedStatement
showMessageDialog example");
pst=conn.prepareStatement(sql);
ResultSet rs=pst.executeQuery();
JOptionPane.showMessageDialog(frame,
"Feature comming soon!!");
Clientable.setModel(DbUtils.resultSetToT
}
ableModel(rs));
}
private void
catch(Exception ex)
ClientsActionPerformed(java.awt.event.Ac
tionEvent evt) { {
this.setVisible(false);
JOptionPane.showMessageDialog(null,
new Clients().setVisible(true);
ex);
}
}
}
private void
InventoryActionPerformed(java.awt.event.
ActionEvent evt) { private void
Edit1ActionPerformed(java.awt.event.Acti
// TODO add your handling code
onEvent evt) {
here:
this.setVisible(false);
}
new Edit_ItemGUI().setVisible(true);
}
private void
AddActionPerformed(java.awt.event.Actio
nEvent evt) {
this.setVisible(false);
private void private void
ReportActionPerformed(java.awt.event.Ac Search1ActionPerformed(java.awt.event.A
tionEvent evt) { ctionEvent evt) {
// TODO add your handling code
here:
this.setVisible(false);
}
new Out_of_Stock().setVisible(true);
}
private void
GoActionPerformed(java.awt.event.Action
private void Event evt) {
DeleteActionPerformed(java.awt.event.Act
ionEvent evt) {
connE.Search_Inventory(Search1.getText
String Input = ());
JOptionPane.showInputDialog("Enter
}
Control Number: ");
try {
private void
jButton1ActionPerformed(java.awt.event.A
Class.forName("net.ucanaccess.jdbc.Uca
ctionEvent evt) {
naccessDriver");
this.setVisible(false);
cn =
DriverManager.getConnection("jdbc:ucana new Over_Stock().setVisible(true);
ccess://C:\\Users\\Noel
}
Portillo\\Desktop//Final Project.accdb");
String sql = "Delete from Products
where Control_Number = '"+Input+"' "; /**
s = cn.createStatement(); * @param args the command line
arguments
s.executeUpdate(sql);
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
}
//<editor-fold defaultstate="collapsed"
catch (Exception ex) {
desc=" Look and feel setting code
(optional) ">
JOptionPane.showMessageDialog(null,
/* If Nimbus (introduced in Java SE
ex);
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 { /* Create and display the form */
for
(javax.swing.UIManager.LookAndFeelInfo java.awt.EventQueue.invokeLater(new
info : Runnable() {
javax.swing.UIManager.getInstalledLookA
public void run() {
ndFeels()) {
new Inventory().setVisible(true);
if
("Nimbus".equals(info.getName())) { }
});
javax.swing.UIManager.setLookAndFeel(i
nfo.getClassName()); }
break;
} // Variables declaration - do not modify
public Add_ItemGUI() {
jLabel2.setText("Brand:");
initComponents();
}
jLabel3.setText("Stock:");
Cancel.setText("Cancel");
@SuppressWarnings("unchecked")
Cancel.addActionListener(new
// <editor-fold defaultstate="collapsed" java.awt.event.ActionListener() {
desc="Generated Code">
public void
private void initComponents() { actionPerformed(java.awt.event.ActionEve
nt evt) {
.addComponent(Cancel))
javax.swing.GroupLayout layout =
new
.addGroup(layout.createSequentialGroup(
javax.swing.GroupLayout(getContentPane
)
());
getContentPane().setLayout(layout);
.addGroup(layout.createParallelGroup(jav
layout.setHorizontalGroup( ax.swing.GroupLayout.Alignment.TRAILIN
G)
layout.createParallelGroup(javax.swing.Gr
oupLayout.Alignment.LEADING) .addComponent(jLabel3)
.addGroup(layout.createSequentialGroup( .addComponent(jLabel2)
)
.addComponent(jLabel1))
.addGroup(layout.createParallelGroup(jav
.addGap(18, 18, 18)
ax.swing.GroupLayout.Alignment.LEADIN
G)
.addGroup(layout.createParallelGroup(jav
ax.swing.GroupLayout.Alignment.LEADIN
.addGroup(layout.createSequentialGroup(
G, false)
)
.addGap(96, 96, 96)
.addComponent(Control)
.addComponent(jLabel4,
javax.swing.GroupLayout.PREFERRED_
.addComponent(Brand)
SIZE, 208,
javax.swing.GroupLayout.PREFERRED_
SIZE)) .addComponent(Stock,
javax.swing.GroupLayout.DEFAULT_SIZE
, 111, Short.MAX_VALUE))))))
.addGroup(layout.createSequentialGroup(
) .addContainerGap(96,
Short.MAX_VALUE))
.addGap(70, 70, 70)
);
.addGroup(layout.createParallelGroup(jav layout.setVerticalGroup(
.addComponent(jLabel3)
layout.createParallelGroup(javax.swing.Gr
.addComponent(Stock,
oupLayout.Alignment.LEADING)
javax.swing.GroupLayout.PREFERRED_
SIZE,
.addGroup(layout.createSequentialGroup( javax.swing.GroupLayout.DEFAULT_SIZE
) ,
javax.swing.GroupLayout.PREFERRED_
.addGap(24, 24, 24)
SIZE))
.addComponent(jLabel4,
.addGap(18, 18, 18)
javax.swing.GroupLayout.DEFAULT_SIZE
, 61, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(jav
ax.swing.GroupLayout.Alignment.BASELI
.addPreferredGap(javax.swing.LayoutStyl
NE)
e.ComponentPlacement.UNRELATED)
.addComponent(Cancel)
.addGroup(layout.createParallelGroup(jav .addComponent(Submit))
ax.swing.GroupLayout.Alignment.BASELI
.addGap(73, 73, 73))
NE)
);
.addComponent(jLabel1)
.addComponent(Control,
javax.swing.GroupLayout.PREFERRED_ pack();
SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE }// </editor-fold>
,
javax.swing.GroupLayout.PREFERRED_
SIZE)) private void
SubmitActionPerformed(java.awt.event.Ac
.addGap(15, 15, 15) tionEvent evt) {
try {
.addGroup(layout.createParallelGroup(jav
ax.swing.GroupLayout.Alignment.BASELI
NE)
String str = Control.getText();
.addComponent(jLabel2)
String str1 = Brand.getText();
.addComponent(Brand,
String str2 = Stock.getText();
javax.swing.GroupLayout.PREFERRED_
SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE
,
javax.swing.GroupLayout.PREFERRED_ Class.forName("net.ucanaccess.jdbc.Uca
SIZE)) naccessDriver");
setVisible(false);
javax.swing.UIManager.setLookAndFeel(i
Add_ItemGUI form = new nfo.getClassName());
Add_ItemGUI();
break;
form.setVisible(false);
}
new Inventory().setVisible(true);
}
}
} catch (ClassNotFoundException ex)
{
private void
CancelActionPerformed(java.awt.event.Ac java.util.logging.Logger.getLogger(Add_Ite
tionEvent evt) { mGUI.class.getName()).log(java.util.loggin
this.setVisible(false); g.Level.SEVERE, null, ex);
}
java.util.logging.Logger.getLogger(Add_Ite
mGUI.class.getName()).log(java.util.loggin
g.Level.SEVERE, null, ex);
/**
} catch (IllegalAccessException ex) {
* @param args the command line
arguments
java.util.logging.Logger.getLogger(Add_Ite
*/
mGUI.class.getName()).log(java.util.loggin
public static void main(String args[]) { g.Level.SEVERE, null, ex);
import java.sql.DriverManager;
import java.sql.ResultSet;
javax.swing.GroupLayout layout =
setDefaultCloseOperation(javax.swing.Wi new
ndowConstants.EXIT_ON_CLOSE); javax.swing.GroupLayout(getContentPane
());
setTitle("Edit Item");
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
jLabel1.setText("Control Number:");
layout.createParallelGroup(javax.swing.Gr
jLabel2.setText("Brand:"); oupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Align
jLabel3.setText("Stock:"); ment.TRAILING,
layout.createSequentialGroup()
jLabel4.setFont(new .addContainerGap(93,
java.awt.Font("Tahoma", 1, 36)); // Short.MAX_VALUE)
NOI18N .addComponent(jLabel4,
jLabel4.setText("EDIT ITEM"); javax.swing.GroupLayout.PREFERRED_
SIZE, 208,
javax.swing.GroupLayout.PREFERRED_
SIZE)
Submit.setText("Submit");
.addGap(93, 93, 93))
Submit.addActionListener(new
java.awt.event.ActionListener() {
.addGroup(layout.createSequentialGroup(
public void
)
actionPerformed(java.awt.event.ActionEve
nt evt) {
.addGroup(layout.createParallelGroup(jav
SubmitActionPerformed(evt);
ax.swing.GroupLayout.Alignment.LEADIN
} G)
});
.addGroup(layout.createSequentialGroup(
)
Cancel.setText("Cancel"); .addGap(119, 119, 119)
Cancel.addActionListener(new .addComponent(Submit))
java.awt.event.ActionListener() {
public void .addGroup(layout.createSequentialGroup(
actionPerformed(java.awt.event.ActionEve )
nt evt) {
.addGap(70, 70, 70)
CancelActionPerformed(evt);
} .addGroup(layout.createParallelGroup(jav
}); ax.swing.GroupLayout.Alignment.TRAILIN
G)
.addGap(24, 24, 24)
.addGroup(layout.createSequentialGroup(
.addComponent(jLabel4,
)
javax.swing.GroupLayout.DEFAULT_SIZE
, 64, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(jav
.addGap(18, 18, 18)
ax.swing.GroupLayout.Alignment.TRAILIN
G)
.addGroup(layout.createParallelGroup(jav
ax.swing.GroupLayout.Alignment.BASELI
.addComponent(jLabel3)
NE)
.addComponent(jLabel1)
.addComponent(jLabel2)
.addComponent(Control,
javax.swing.GroupLayout.PREFERRED_
.addComponent(jLabel1))
SIZE,
.addGap(18, 18, 18) javax.swing.GroupLayout.DEFAULT_SIZE
,
javax.swing.GroupLayout.PREFERRED_
.addGroup(layout.createParallelGroup(jav
SIZE))
ax.swing.GroupLayout.Alignment.LEADIN
G, false) .addGap(21, 21, 21)
.addComponent(Brand) .addGroup(layout.createParallelGroup(jav
ax.swing.GroupLayout.Alignment.BASELI
NE)
.addComponent(Stock,
javax.swing.GroupLayout.DEFAULT_SIZE .addComponent(jLabel2)
, 111, Short.MAX_VALUE)
.addComponent(Brand,
javax.swing.GroupLayout.PREFERRED_
.addComponent(Control))) SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE
,
.addComponent(Cancel))))
javax.swing.GroupLayout.PREFERRED_
SIZE))
.addContainerGap(javax.swing.GroupLay
.addGap(21, 21, 21)
out.DEFAULT_SIZE,
Short.MAX_VALUE))
.addGroup(layout.createParallelGroup(jav
);
ax.swing.GroupLayout.Alignment.BASELI
layout.setVerticalGroup( NE)
.addComponent(jLabel3)
layout.createParallelGroup(javax.swing.Gr
.addComponent(Stock,
oupLayout.Alignment.LEADING)
javax.swing.GroupLayout.PREFERRED_
SIZE,
.addGroup(javax.swing.GroupLayout.Align javax.swing.GroupLayout.DEFAULT_SIZE
ment.TRAILING, ,
layout.createSequentialGroup() javax.swing.GroupLayout.PREFERRED_
SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(jav
}
ax.swing.GroupLayout.Alignment.BASELI
NE) catch (Exception ex) {
.addComponent(Submit) System.out.println(ex);
.addComponent(Cancel)) }
.addGap(51, 51, 51)) setVisible(false);
); Edit_ItemGUI form = new
Edit_ItemGUI();
form.setVisible(false);
pack();
new Inventory().setVisible(true);
}// </editor-fold>
}
private void
SubmitActionPerformed(java.awt.event.Ac private void
tionEvent evt) { CancelActionPerformed(java.awt.event.Ac
tionEvent evt) {
try {
this.setVisible(false);
new Inventory().setVisible(true);
String str = Brand.getText();
}
String str1 = Control.getText();
String str2 = Stock.getText();
/**
* @param args the command line
arguments
Class.forName("net.ucanaccess.jdbc.Uca
naccessDriver"); */
Connection cn = public static void main(String args[]) {
DriverManager.getConnection("jdbc:ucana
ccess://C:\\Users\\Noel /* Set the Nimbus look and feel */
Portillo\\Desktop\\Final Project.accdb"); //<editor-fold defaultstate="collapsed"
state = cn.createStatement(); desc=" Look and feel setting code
(optional) ">
String sql = "Update Products
set Brand = '"+str+"', Stocks = '"+str2+"' /* If Nimbus (introduced in Java SE
Where Control_Number = '"+str1+"'"; 6) is not available, stay with the default
look and feel.
state.execute(sql);
* For details see
System.out.println("Element is http://download.oracle.com/javase/tutorial/
Edited"); uiswing/lookandfeel/plaf.html
cn.close(); */
try { /* Create and display the form */
for
(javax.swing.UIManager.LookAndFeelInfo java.awt.EventQueue.invokeLater(new
info : Runnable() {
javax.swing.UIManager.getInstalledLookA
public void run() {
ndFeels()) {
new
if
Edit_ItemGUI().setVisible(true);
("Nimbus".equals(info.getName())) {
}
javax.swing.UIManager.setLookAndFeel(i });
nfo.getClassName());
}
break;
}
// Variables declaration - do not modify
}
private javax.swing.JTextField Brand;
} catch (ClassNotFoundException ex)
{ private javax.swing.JButton Cancel;
private javax.swing.JTextField Control;
java.util.logging.Logger.getLogger(Edit_Ite private javax.swing.JTextField Stock;
mGUI.class.getName()).log(java.util.loggin
g.Level.SEVERE, null, ex); private javax.swing.JButton Submit;
java.util.logging.Logger.getLogger(Edit_Ite
mGUI.class.getName()).log(java.util.loggin import java.sql.Connection;
g.Level.SEVERE, null, ex);
import java.sql.DriverManager;
}
import java.sql.PreparedStatement;
//</editor-fold>
import java.sql.ResultSet;
import javax.swing.JOptionPane;
import net.proteanit.sql.DbUtils;
jScrollPane1 = new
javax.swing.JScrollPane();
tblOut_of_Stock = new
public class Out_of_Stock extends
javax.swing.JTable();
javax.swing.JFrame {
Back = new javax.swing.JButton();
public Out_of_Stock() {
setDefaultCloseOperation(javax.swing.Wi
initComponents(); ndowConstants.EXIT_ON_CLOSE);
Connection
conn=DriverManager.getConnection("jdbc
tblOut_of_Stock.setModel(new
:ucanaccess://C:\\Users\\Noel
javax.swing.table.DefaultTableModel(
Portillo\\Desktop\\Final Project.accdb");
new Object [][] {
String sql="select
Control_Number,Brand,Stocks from
Products where Stocks = 0";
},
PreparedStatement
new String [] {
pst=conn.prepareStatement(sql);
"Control Number", "Brand",
ResultSet rs=pst.executeQuery();
"Stock"
}
tblOut_of_Stock.setModel(DbUtils.resultS
etToTableModel(rs)); ));
}
jScrollPane1.setViewportView(tblOut_of_
catch(Exception ex)
Stock);
{
Back.setText("Back");
JOptionPane.showMessageDialog(null,
ex); Back.addActionListener(new
java.awt.event.ActionListener() {
}
public void
}
actionPerformed(java.awt.event.ActionEve
nt evt) {
BackActionPerformed(evt);
@SuppressWarnings("unchecked") }
// <editor-fold defaultstate="collapsed" });
desc="Generated Code">
private void initComponents() {
javax.swing.GroupLayout layout = javax.swing.GroupLayout.PREFERRED_
new SIZE)
javax.swing.GroupLayout(getContentPane
.addGap(18, 18, 18)
());
.addComponent(Back)
getContentPane().setLayout(layout);
.addContainerGap(44,
layout.setHorizontalGroup(
Short.MAX_VALUE))
);
layout.createParallelGroup(javax.swing.Gr
oupLayout.Alignment.LEADING)
pack();
.addGroup(layout.createSequentialGroup(
) }// </editor-fold>
.addComponent(jScrollPane1, try {
javax.swing.GroupLayout.PREFERRED_ for
SIZE, 275, (javax.swing.UIManager.LookAndFeelInfo
info :
javax.swing.UIManager.getInstalledLookA java.awt.EventQueue.invokeLater(new
ndFeels()) { Runnable() {
if public void run() {
("Nimbus".equals(info.getName())) {
new
Out_of_Stock().setVisible(true);
javax.swing.UIManager.setLookAndFeel(i
}
nfo.getClassName());
});
break;
}
}
}
// Variables declaration - do not modify
} catch (ClassNotFoundException ex)
{ private javax.swing.JButton Back;
private javax.swing.JScrollPane
java.util.logging.Logger.getLogger(Out_of jScrollPane1;
_Stock.class.getName()).log(java.util.loggi
ng.Level.SEVERE, null, ex); private javax.swing.JTable
tblOut_of_Stock;
} catch (InstantiationException ex) {
// End of variables declaration
java.util.logging.Logger.getLogger(Out_of }
_Stock.class.getName()).log(java.util.loggi
ng.Level.SEVERE, null, ex); Over_Stock.java
} catch (IllegalAccessException ex) { package projectf1;
//</editor-fold> *
* @author Noel Portillo
import java.sql.Connection;
java.util.logging.Logger.getLogger(Over_S
tock.class.getName()).log(java.util.logging. import java.sql.DriverManager;
Level.SEVERE, null, ex); import java.sql.PreparedStatement;
} import java.sql.ResultSet;
//</editor-fold> import javax.swing.JOptionPane;
import java.lang.String; //ResultSet rs=pst.executeQuery();
import java.sql.Statement; conn =
DriverManager.getConnection("jdbc:ucana
import net.proteanit.sql.DbUtils;
ccess://C:\\Users\\Noel
Portillo\\Desktop//Final Project.accdb");
* rs = stmt.executeQuery("Select
Control_Number, Brand, Stocks from
* @author Noel Portillo Products where Control_Number =
*/ '"+Search1+"' or Brand = '"+Search1+"' or
Stocks = '"+Search1+"'");
public class Search_Inventory extends
javax.swing.JFrame {
tblSearch_Inventory.setModel(DbUtils.res
private Connection conn; ultSetToTableModel(rs));
public Statement stmt; new Inventory().setVisible(false);
public ResultSet rs; this.setVisible(true);
/**String Search1; rs.close();
* Creates new form Search_Inventory conn.close();
*/ }
initComponents(); JOptionPane.showMessageDialog(null,
ex);
}
try {
}
//Connection conn =
DriverManager.getConnection("jdbc:ucana
ccess://C:\\Users\\Noel
Portillo\\Desktop\\Final Project.accdb");
//String sql="select
Control_Number, Brand, Stocks from
Products where Control_Number =
'"+Search2+"' or Brand = '"+Search2+"' or /**
Stocks = '"+Search2+"'";
* This method is called from within the
//PreparedStatement constructor to initialize the form.
pst=conn.prepareStatement(sql);
* WARNING: Do NOT modify this
code. The content of this method is
Back.setText("Back");
always
Back.addActionListener(new
* regenerated by the Form Editor.
java.awt.event.ActionListener() {
*/
public void
@SuppressWarnings("unchecked") actionPerformed(java.awt.event.ActionEve
nt evt) {
// <editor-fold defaultstate="collapsed"
desc="Generated Code"> BackActionPerformed(evt);
private void initComponents() { }
});
jLabel1 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.GroupLayout layout =
javax.swing.JScrollPane(); new
javax.swing.GroupLayout(getContentPane
tblSearch_Inventory = new
());
javax.swing.JTable();
getContentPane().setLayout(layout);
Back = new javax.swing.JButton();
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.Gr
setDefaultCloseOperation(javax.swing.Wi
oupLayout.Alignment.LEADING)
ndowConstants.EXIT_ON_CLOSE);
.addGroup(layout.createSequentialGroup(
jLabel1.setText("Search Results: "); )
.addContainerGap()
tblSearch_Inventory.setModel(new
javax.swing.table.DefaultTableModel( .addGroup(layout.createParallelGroup(jav
ax.swing.GroupLayout.Alignment.LEADIN
new Object [][] { G, false)
}, .addGroup(layout.createSequentialGroup(
)
new String [] {
.addComponent(jLabel1)
"Control_Number", "Brand",
"Stock"
.addPreferredGap(javax.swing.LayoutStyl
} e.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE
));
, Short.MAX_VALUE)
.addComponent(Back))
jScrollPane1.setViewportView(tblSearch_I
nventory);
.addComponent(jScrollPane1,
javax.swing.GroupLayout.PREFERRED_ private void
SIZE, BackActionPerformed(java.awt.event.Acti
javax.swing.GroupLayout.DEFAULT_SIZE onEvent evt) {
,
this.setVisible(false);
javax.swing.GroupLayout.PREFERRED_
SIZE)) new Inventory().setVisible(true);
}
.addContainerGap(javax.swing.GroupLay
out.DEFAULT_SIZE,
Short.MAX_VALUE)) /**
); * @param args the command line
layout.setVerticalGroup( arguments
*/
layout.createParallelGroup(javax.swing.Gr public static void main(String args[]) {
oupLayout.Alignment.LEADING)
/* Set the Nimbus look and feel */
java.util.logging.Logger.getLogger(Search
_Inventory.class.getName()).log(java.util.l
ogging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Search
_Inventory.class.getName()).log(java.util.l
ogging.Level.SEVERE, null, ex);
}
} catch
(javax.swing.UnsupportedLookAndFeelEx
ception ex) {
java.util.logging.Logger.getLogger(Search
_Inventory.class.getName()).log(java.util.l
ogging.Level.SEVERE, null, ex);
}
//</editor-fold>
Output:
About
Clients Inventory
New Client
Welcome Message
Out of stock
Log In form
Over Stock