Friday, April 13, 2007

Accession

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class Accession extends JFrame {

boolean inAnApplet = true;
private boolean laidOut = false;
private JPanel panel;
// private JButton Loan, b2, b3,Next,Exit;
private JLabel label, label1,label3,label4,label2;

private JTextField nameField,name,middle,last;
private JTable table;
private JScrollPane scrollPane;
private JButton Cancel, Exit,Menu,Save;
public Accession() {
Container contentPane = getContentPane();
contentPane.setLayout(null);
panel = new JPanel();
panel.setLayout( new BorderLayout() );
getContentPane().add( panel );
label1 = new JLabel("CJC High school Library System");
contentPane.add(label1);
label = new JLabel("Accession NO:");
contentPane.add(label);
label2 = new JLabel("First Name");
contentPane.add(label2);
label3= new JLabel("Last Name");
contentPane.add(label3);
label4= new JLabel("Middle Name");
contentPane.add(label4);
nameField = new JTextField(1);
contentPane.add(nameField);

String columnNames[] = { "Name", "Address", "Grade/sec"," Return Book " , "Book Title " , " Due Date" };

// Create some data
String dataValues[][] =
{
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},
{ "", "", "", "", "", ""},

};




table= new JTable(dataValues, columnNames);
scrollPane = new JScrollPane(table);
//variable.add(table);
//contentPane.add(variable);
panel.add( scrollPane, BorderLayout.CENTER );
Exit = new JButton("Exit");
contentPane.add(Exit);

Menu = new JButton("Main");
contentPane.add(Menu);
//b3 = new JButton("Inventory");
//contentPane.add(b3);
Save = new JButton("Save");
contentPane.add(Save);
Cancel= new JButton("Cancel");
contentPane.add(Cancel);
Insets insets = contentPane.getInsets();
label1.setBounds(250+insets.left,1+insets.top,300,100);
label.setBounds(100+insets.left,80+insets.top,100,30);
nameField.setBounds(200+insets.left,100+insets.top,80,20);


//main.setBounds(60+insets.left,60+insets.top,10,30);
panel.setBounds(150 + insets.left, 180 + insets.top,500,200);
Exit.setBounds(200 + insets.left, 400 + insets.top, 100, 30);
Menu.setBounds(300 + insets.left,400 + insets.top, 100,30 );
Save.setBounds(400+ insets.left,400+insets.top,100,30);
Cancel.setBounds( 500+insets.left,400+insets.top,100,30);


Menu.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent l){
NoneWindow e = new NoneWindow();
e.setSize(600,600);
e.show();
}
}
);

Menu.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent l){
NoneWindow e = new NoneWindow();
e.setSize(600,600);
e.show();
}
}
);


// Loan.addActionListener(new ActionListener(){
// public void actionPerformed(ActionEvent l){
//Loan e = new Loan();
//e.setSize(600,600);
//e.show();
// }
// }
//);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
if (inAnApplet) {
dispose();
} else {
System.exit(0);
}
}
});
}


public static void main(String args[]) {
Accession window = new Accession();
Insets insets = window.getInsets();
window.inAnApplet = false;

window.setTitle("ACCESSION NUMBER");
window.setSize(300 + insets.left + insets.right,
200 + insets.top + insets.bottom);
window.setVisible(true);
}
//public static void main (String args[]){
//}//
}

No comments: