База данных "Тюрьма"

Разработка базы данных "Тюрьма" для управления информацией, повышение оперативности выдачи информации, добавления и хранения информации о заключенных, охранниках и обслуживающем персонале. Использование языка Java, среды разработки NetBeans и СУБД Derby.

Рубрика Программирование, компьютеры и кибернетика
Вид курсовая работа
Язык русский
Дата добавления 31.01.2016
Размер файла 996,8 K

Отправить свою хорошую работу в базу знаний просто. Используйте форму, расположенную ниже

Студенты, аспиранты, молодые ученые, использующие базу знаний в своей учебе и работе, будут вам очень благодарны.

jLabel10.setText("Отчество:");

TelText1.setText(" ");

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

jLabel2.setText("Телефон:");

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

jLabel7.setText("Дата рождения:");

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

jLabel8.setText("Номер школы:");

AddKid.setText("Добавить");

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

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

AddKidActionPerformed(evt);

}

});

jScrollPane1.setViewportView(ProblemsText1);

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

jLabel1.setText("Проблема:");

jButton1.setText("Показать ");

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

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

jButton1ActionPerformed(evt);

}

});

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

jPanel1.setLayout(jPanel1Layout);

jPanel1Layout.setHorizontalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel1Layout.createSequentialGroup()

.addContainerGap()

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addGroup(jPanel1Layout.createSequentialGroup()

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addComponent(jLabel7)

.addComponent(jLabel8)

.addComponent(jLabel1)

.addComponent(jLabel2)

.addComponent(jLabel10)

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

.addComponent(jLabel9)

.addComponent(jLabel4)))

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

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

.addComponent(SchoolText1, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(FirstNameText1, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(TelText1, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(ThirdNameText1, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(NameText1, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGroup(jPanel1Layout.createSequentialGroup()

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

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

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

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

.addComponent(Year))))

.addGroup(jPanel1Layout.createSequentialGroup()

.addComponent(AddKid)

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

.addComponent(jButton1)))

.addContainerGap(20, Short.MAX_VALUE))

);

jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {FirstNameText1, NameText1, SchoolText1, TelText1, ThirdNameText1, jScrollPane1});

jPanel1Layout.setVerticalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

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

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

.addComponent(jLabel4)

.addComponent(FirstNameText1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

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

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

.addComponent(jLabel9)

.addComponent(NameText1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

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

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

.addComponent(jLabel10)

.addComponent(ThirdNameText1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

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

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

.addComponent(TelText1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel2))

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

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

.addComponent(jLabel7)

.addComponent(Day, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(Mounth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(Year, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

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

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

.addComponent(jLabel8)

.addComponent(SchoolText1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

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

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

.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel1))

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

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

.addComponent(jButton1)

.addComponent(AddKid))

.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, 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()

.addContainerGap()

.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)

.addGroup(layout.createSequentialGroup()

.addContainerGap()

.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))

);

getAccessibleContext().setAccessibleName("");

pack();

}// </editor-fold>

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

try {

String url = "jdbc:derby://localhost:1527/admin";

String username = "Nikita";

String password = "909878";

Connection con = DriverManager.getConnection(url,username,password);

Statement stmt = con.createStatement();

String firstName = FirstNameText1.getText();

String Name = NameText1.getText();

String thirdName = ThirdNameText1.getText();

String Tel = TelText1.getText();

String school = SchoolText1.getText();

String problem = ProblemsText1.getText();

firstName = firstName.replaceAll("\\s", "");

Name = Name.replaceAll("\\s", "");

thirdName = thirdName.replaceAll("\\s", "");

Tel = Tel.replaceAll("\\s", "");

work = work.replaceAll("\\s", "");

task = task.replaceAll("\\s", "");

String date = Day.getText() + "." + Mounth.getText() + "." + Year.getText();

Addition add = new Addition();

add.addAgreement(firstName, Name, thirdName, Tel, date, work, task);

FirstNameText1.setText(null);

NameText1.setText(null);

ThirdNameText1.setText(null);

TelText1.setText(null);

Day.setText(null);

Mounth.setText(null);

Year.setText(null);

work.setText(null);

task.setText(null);

}

catch(SQLException ex){

JOptionPane.showMessageDialog(null, ex.toString());

}

}

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

Viev v = new Viev();

v.setVisible(true);

v.toFront();

}

public static int getResultSetRowCount(ResultSet resultSet) {

int size = 0;

try {

resultSet.last();

size = resultSet.getRow();

resultSet.beforeFirst();

}

catch(SQLException ex) {

return 0;

}

return size;

}

/**

* @param args the command line arguments

*/

public static void main(String args[]) {

/* Set the Nimbus look and feel */

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

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

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

*/

try {

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

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

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

break;

}

}

} catch (ClassNotFoundException ex) {

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

} catch (InstantiationException ex) {

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

} catch (IllegalAccessException ex) {

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

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

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

}

//</editor-fold>

/* Create and display the form */

java.awt.EventQueue.invokeLater(() -> {

new Kids().setVisible(true);

});

}

// Variables declaration - do not modify

private javax.swing.JButton AddKid;

private javax.swing.JTextField Day;

private javax.swing.JTextField FirstNameText1;

private javax.swing.JTextField Mounth;

private javax.swing.JTextField NameText1;

private javax.swing.JTextPane ProblemsText1;

private javax.swing.JTextField SchoolText1;

private javax.swing.JTextField TelText1;

private javax.swing.JTextField ThirdNameText1;

private javax.swing.JTextField Year;

private javax.swing.JButton jButton1;

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel10;

private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel4;

private javax.swing.JLabel jLabel7;

private javax.swing.JLabel jLabel8;

private javax.swing.JLabel jLabel9;

private javax.swing.JPanel jPanel1;

private javax.swing.JScrollPane jScrollPane1;

// End of variables declaration

}

Приложение F. Исходный код

Листинг файла VievAgreement.java

package kids;

import java.awt.ScrollPane;

import java.util.*;

import java.sql.*;

import javax.swing.JOptionPane;

import javax.swing.table.*;

public class Viev extends javax.swing.JFrame {

private String what = "ФАМИЛИЯ, ИМЯ, ОТЧЕСТВО, ТЕЛЕФОН";

private String from = "AGREEMENT";

private String where = "ФАМИЛИЯ";

private String col1="Фамилия", col2="Имя", col3="Отчество", col4="Телефон";

public VievAgreement() {

initComponents();

update();

}

@SuppressWarnings("unchecked")

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

private void initComponents() {

jPanel1 = new javax.swing.JPanel();

jScrollPane1 = new javax.swing.JScrollPane();

jTable1 = new javax.swing.JTable();

jPanel2 = new javax.swing.JPanel();

Refresh = new javax.swing.JButton();

SearchButtom = new javax.swing.JButton();

SearchText = new javax.swing.JTextField();

Delete = new javax.swing.JButton();

jButton1 = new javax.swing.JButton();

jPanel3 = new javax.swing.JPanel();

jScrollPane2 = new javax.swing.JScrollPane();

ProblemArea = new javax.swing.JTextArea();

jLabel1 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setTitle("Просмотр таблицы");

jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Таблица из базы данных", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12))); // NOI18N

jTable1.setModel(new javax.swing.table.DefaultTableModel(

new Object [][] {

{null, null, null, null},

{null, null, null, null},

{null, null, null, null}

},

new String [] {

"Фамилия", "Title 2", "Title 3", "Title 4"

}

));

jTable1.addFocusListener(new java.awt.event.FocusAdapter() {

public void focusGained(java.awt.event.FocusEvent evt) {

jTable1FocusGained(evt);

}

});

jTable1.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

jTable1MouseClicked(evt);

}

public void mouseEntered(java.awt.event.MouseEvent evt) {

jTable1MouseEntered(evt);

}

});

jTable1.addInputMethodListener(new java.awt.event.InputMethodListener() {

public void caretPositionChanged(java.awt.event.InputMethodEvent evt) {

jTable1CaretPositionChanged(evt);

}

public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) {

}

});

jTable1.addPropertyChangeListener(new java.beans.PropertyChangeListener() {

public void propertyChange(java.beans.PropertyChangeEvent evt) {

jTable1PropertyChange(evt);

}

});

jTable1.addKeyListener(new java.awt.event.KeyAdapter() {

public void keyPressed(java.awt.event.KeyEvent evt) {

jTable1KeyPressed(evt);

}

public void keyTyped(java.awt.event.KeyEvent evt) {

jTable1KeyTyped(evt);

}

});

jScrollPane1.setViewportView(jTable1);

if (jTable1.getColumnModel().getColumnCount() > 0) {

jTable1.getColumnModel().getColumn(3).setResizable(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()

.addContainerGap()

.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 550, Short.MAX_VALUE)

.addContainerGap())

);

jPanel1Layout.setVerticalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel1Layout.createSequentialGroup()

.addContainerGap()

.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE)

.addContainerGap())

);

jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Панель управления", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12))); // NOI18N

Refresh.setText("Добавить");

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

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

RefreshActionPerformed(evt);

}

});

SearchButtom.setText("Поиск по фамилиям");

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

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

SearchButtomActionPerformed(evt);

}

});

SearchText.addInputMethodListener(new java.awt.event.InputMethodListener() {

public void caretPositionChanged(java.awt.event.InputMethodEvent evt) {

}

public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) {

SearchTextInputMethodTextChanged(evt);

}

});

Delete.setText("Удалить");

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

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

DeleteActionPerformed(evt);

}

});

jButton1.setText("Показать");

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

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

jButton1ActionPerformed(evt);

}

});

javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);

jPanel2.setLayout(jPanel2Layout);

jPanel2Layout.setHorizontalGroup(

jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel2Layout.createSequentialGroup()

.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)

.addComponent(SearchText)

.addComponent(SearchButtom, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()

.addComponent(Refresh)

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

.addComponent(Delete))

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

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

);

jPanel2Layout.setVerticalGroup(

jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel2Layout.createSequentialGroup()

.addContainerGap()

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

.addComponent(Refresh)

.addComponent(Delete))

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

.addComponent(SearchButtom)

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

.addComponent(SearchText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 41, Short.MAX_VALUE))

);

jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Дополнительная информация о ребенке", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12))); // NOI18N

ProblemArea.setColumns(20);

ProblemArea.setRows(5);

jScrollPane2.setViewportView(ProblemArea);

jLabel1.setText("Проблема");

javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);

jPanel3.setLayout(jPanel3Layout);

jPanel3Layout.setHorizontalGroup(

jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel3Layout.createSequentialGroup()

.addGap(40, 40, 40)

.addComponent(jLabel1)

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

.addGroup(jPanel3Layout.createSequentialGroup()

.addContainerGap()

.addComponent(jScrollPane2)

.addContainerGap())

);

jPanel3Layout.setVerticalGroup(

jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

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

.addComponent(jLabel1)

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

.addComponent(jScrollPane2)

.addContainerGap())

);

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

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

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

.addGroup(layout.createSequentialGroup()

.addContainerGap()

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

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

.addGroup(layout.createSequentialGroup()

.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

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

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

.addContainerGap())

);

layout.setVerticalGroup(

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

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

.addContainerGap()

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

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

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

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

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

.addContainerGap())

);

pack();

}// </editor-fold>

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

int col = jTable1.getSelectedColumn();

String selectedRow = jTable1.getModel().getValueAt(jTable1.getSelectedRow(),0).toString();

if(jTable1.getSelectedColumn() != -1){

List l = new List();

l.deleteRow(col, selectedRow);

update();

}

}

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

Kids kid = new Kids();

kid.setVisible(true);

kid.toFront();

}

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

DefaultTableModel dtm = new DefaultTableModel();

List list = new List();

dtm = list.findElement(dtm, col1, col2, col3, col4, what, from, SearchText.getText());

jTable1.setModel(dtm);

}

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

// TODO add your handling code here:

update();

}

public static void main(String args[]) {

/* Set the Nimbus look and feel */

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

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

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

*/

try {

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

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

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

break;

}

}

} catch (ClassNotFoundException ex) {

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

} catch (InstantiationException ex) {

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

} catch (IllegalAccessException ex) {

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

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

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

}

//</editor-fold>

/* Create and display the form */

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

public void run() {

new Viev().setVisible(true);

}

});

}

private void update(){

DefaultTableModel dtm = new DefaultTableModel();

List list = new List();

dtm = list.fillList(dtm, col1, col2, col3, col4, what, from);

jTable1.setModel(dtm);

}

// Variables declaration - do not modify

private javax.swing.JButton Delete;

private javax.swing.JTextArea ProblemArea;

private javax.swing.JButton Refresh;

private javax.swing.JButton SearchButtom;

private javax.swing.JTextField SearchText;

private javax.swing.JButton jButton1;

private javax.swing.JLabel jLabel1;

private javax.swing.JPanel jPanel1;

private javax.swing.JPanel jPanel2;

private javax.swing.JPanel jPanel3;

private javax.swing.JScrollPane jScrollPane1;

private javax.swing.JScrollPane jScrollPane2;

private javax.swing.JTable jTable1;

// End of variables declaration

}

Приложение G. Исходный код

Листинг файла VievLesson.java

package kids;

import java.awt.ScrollPane;

import java.util.*;

import java.sql.*;

import javax.swing.JOptionPane;

import javax.swing.table.*;

public class Viev extends javax.swing.JFrame {

private String what = "ДАТА, ВРЕМЯ, ПРЕДМЕТ, ФИО_ПРЕПОДАВАТЕЛЯ";

private String from = "LESSON";

private String where = "ФАМИЛИЯ";

private String col1="Дата", col2="Время", col3="Предмет", col4="Фио_преподавателя";

public VievLesson() {

initComponents();

update();

}

@SuppressWarnings("unchecked")

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

private void initComponents() {

jPanel1 = new javax.swing.JPanel();

jScrollPane1 = new javax.swing.JScrollPane();

jTable1 = new javax.swing.JTable();

jPanel2 = new javax.swing.JPanel();

Refresh = new javax.swing.JButton();

SearchButtom = new javax.swing.JButton();

SearchText = new javax.swing.JTextField();

Delete = new javax.swing.JButton();

jButton1 = new javax.swing.JButton();

jPanel3 = new javax.swing.JPanel();

jScrollPane2 = new javax.swing.JScrollPane();

ProblemArea = new javax.swing.JTextArea();

jLabel1 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setTitle("Просмотр таблицы");

jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Таблица из базы данных", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12))); // NOI18N

jTable1.setModel(new javax.swing.table.DefaultTableModel(

new Object [][] {

{null, null, null, null},

{null, null, null, null},

{null, null, null, null}

},

new String [] {

"Фамилия", "Title 2", "Title 3", "Title 4"

}

));

jTable1.addFocusListener(new java.awt.event.FocusAdapter() {

public void focusGained(java.awt.event.FocusEvent evt) {

jTable1FocusGained(evt);

}

});

jTable1.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

jTable1MouseClicked(evt);

}

public void mouseEntered(java.awt.event.MouseEvent evt) {

jTable1MouseEntered(evt);

}

});

jTable1.addInputMethodListener(new java.awt.event.InputMethodListener() {

public void caretPositionChanged(java.awt.event.InputMethodEvent evt) {

jTable1CaretPositionChanged(evt);

}

public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) {

}

});

jTable1.addPropertyChangeListener(new java.beans.PropertyChangeListener() {

public void propertyChange(java.beans.PropertyChangeEvent evt) {

jTable1PropertyChange(evt);

}

});

jTable1.addKeyListener(new java.awt.event.KeyAdapter() {

public void keyPressed(java.awt.event.KeyEvent evt) {

jTable1KeyPressed(evt);

}

public void keyTyped(java.awt.event.KeyEvent evt) {

jTable1KeyTyped(evt);

}

});

jScrollPane1.setViewportView(jTable1);

if (jTable1.getColumnModel().getColumnCount() > 0) {

jTable1.getColumnModel().getColumn(3).setResizable(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()

.addContainerGap()

.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 550, Short.MAX_VALUE)

.addContainerGap())

);

jPanel1Layout.setVerticalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel1Layout.createSequentialGroup()

.addContainerGap()

.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE)

.addContainerGap())

);

jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Панель управления", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12))); // NOI18N

Refresh.setText("Добавить");

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

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

RefreshActionPerformed(evt);

}

});

SearchButtom.setText("Поиск по фамилиям");

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

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

SearchButtomActionPerformed(evt);

}

});

SearchText.addInputMethodListener(new java.awt.event.InputMethodListener() {

public void caretPositionChanged(java.awt.event.InputMethodEvent evt) {

}

public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) {

SearchTextInputMethodTextChanged(evt);

}

});

Delete.setText("Удалить");

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

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

DeleteActionPerformed(evt);

}

});

jButton1.setText("Показать");

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

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

jButton1ActionPerformed(evt);

}

});

javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);

jPanel2.setLayout(jPanel2Layout);

jPanel2Layout.setHorizontalGroup(

jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel2Layout.createSequentialGroup()

.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)

.addComponent(SearchText)

.addComponent(SearchButtom, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()

.addComponent(Refresh)

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

.addComponent(Delete))

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

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

);

jPanel2Layout.setVerticalGroup(

jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel2Layout.createSequentialGroup()

.addContainerGap()

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

.addComponent(Refresh)

.addComponent(Delete))

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

.addComponent(SearchButtom)

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

.addComponent(SearchText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 41, Short.MAX_VALUE))

);

jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Дополнительная информация о ребенке", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12))); // NOI18N

ProblemArea.setColumns(20);

ProblemArea.setRows(5);

jScrollPane2.setViewportView(ProblemArea);

jLabel1.setText("Проблема");

javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);

jPanel3.setLayout(jPanel3Layout);

jPanel3Layout.setHorizontalGroup(

jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel3Layout.createSequentialGroup()

.addGap(40, 40, 40)

.addComponent(jLabel1)

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

.addGroup(jPanel3Layout.createSequentialGroup()

.addContainerGap()

.addComponent(jScrollPane2)

.addContainerGap())

);

jPanel3Layout.setVerticalGroup(

jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

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

.addComponent(jLabel1)

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

.addComponent(jScrollPane2)

.addContainerGap())

);

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

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

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

.addGroup(layout.createSequentialGroup()

.addContainerGap()

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

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

.addGroup(layout.createSequentialGroup()

.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

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

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

.addContainerGap())

);

layout.setVerticalGroup(

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

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

.addContainerGap()

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

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

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

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

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

.addContainerGap())

);

pack();

}// </editor-fold>

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

int col = jTable1.getSelectedColumn();

String selectedRow = jTable1.getModel().getValueAt(jTable1.getSelectedRow(),0).toString();

if(jTable1.getSelectedColumn() != -1){

List l = new List();

l.deleteRow(col, selectedRow);

update();

}

}

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

Kids kid = new Kids();

kid.setVisible(true);

kid.toFront();

}

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

DefaultTableModel dtm = new DefaultTableModel();

List list = new List();

dtm = list.findElement(dtm, col1, col2, col3, col4, what, from, SearchText.getText());

jTable1.setModel(dtm);

}

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

// TODO add your handling code here:

update();

}

public static void main(String args[]) {

/* Set the Nimbus look and feel */

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

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

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

*/

try {

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

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

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

break;

}

}

} catch (ClassNotFoundException ex) {

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

} catch (InstantiationException ex) {

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

} catch (IllegalAccessException ex) {

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

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

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

}

//</editor-fold>

/* Create and display the form */

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

public void run() {

new Viev().setVisible(true);

}

});

}

private void update(){

DefaultTableModel dtm = new DefaultTableModel();

List list = new List();

dtm = list.fillList(dtm, col1, col2, col3, col4, what, from);

jTable1.setModel(dtm);

}

// Variables declaration - do not modify

private javax.swing.JButton Delete;

private javax.swing.JTextArea ProblemArea;

private javax.swing.JButton Refresh;

private javax.swing.JButton SearchButtom;

private javax.swing.JTextField SearchText;

private javax.swing.JButton jButton1;

private javax.swing.JLabel jLabel1;

private javax.swing.JPanel jPanel1;

private javax.swing.JPanel jPanel2;

private javax.swing.JPanel jPanel3;

private javax.swing.JScrollPane jScrollPane1;

private javax.swing.JScrollPane jScrollPane2;

private javax.swing.JTable jTable1;

// End of variables declaration

}

Приложение O. Исходный код

Листинг файла AdditionLesson.java

package kids;

import java.util.*;

import javax.swing.*;

import java.sql.*;

import javax.swing.JOptionPane;

public class Kids extends javax.swing.JFrame {

/**

* Creates new form Kids

*/

public AdditionLesson() {

initComponents();

for (int i = 1900; i < 2016; i++){

}

}

/**

* 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.

*/

@SuppressWarnings("unchecked")

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

private void initComponents() {

jPanel1 = new javax.swing.JPanel();

FirstNameText1 = new javax.swing.JTextField();

NameText1 = new javax.swing.JTextField();

ThirdNameText1 = new javax.swing.JTextField();

jLabel4 = new javax.swing.JLabel();

jLabel9 = new javax.swing.JLabel();

jLabel10 = new javax.swing.JLabel();

TelText1 = new javax.swing.JTextField();

jLabel2 = new javax.swing.JLabel();

jLabel7 = new javax.swing.JLabel();

SchoolText1 = new javax.swing.JTextField();

jLabel8 = new javax.swing.JLabel();

AddKid = new javax.swing.JButton();

jScrollPane1 = new javax.swing.JScrollPane();

ProblemsText1 = new javax.swing.JTextPane();

jLabel1 = new javax.swing.JLabel();

jButton1 = new javax.swing.JButton();

Day = new javax.swing.JTextField();

Mounth = new javax.swing.JTextField();

Year = new javax.swing.JTextField();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setTitle("Добавление ребенка");

jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Заполнение таблицы", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Times New Roman", 1, 16))); // NOI18N

jPanel1.setDoubleBuffered(false);

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

jLabel4.setText("Фамилия:");

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

jLabel9.setText("Имя:");

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

jLabel10.setText("Отчество:");

TelText1.setText(" ");

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

jLabel2.setText("Телефон:");

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

jLabel7.setText("Дата рождения:");

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

jLabel8.setText("Номер школы:");

AddKid.setText("Добавить");

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

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

AddKidActionPerformed(evt);

}

});

jScrollPane1.setViewportView(ProblemsText1);

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

jLabel1.setText("Проблема:");

jButton1.setText("Показать ");

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

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

jButton1ActionPerformed(evt);

}

});

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

jPanel1.setLayout(jPanel1Layout);

jPanel1Layout.setHorizontalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel1Layout.createSequentialGroup()

.addContainerGap()

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addGroup(jPanel1Layout.createSequentialGroup()

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addComponent(jLabel7)

.addComponent(jLabel8)

.addComponent(jLabel1)

.addComponent(jLabel2)

.addComponent(jLabel10)

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

.addComponent(jLabel9)

.addComponent(jLabel4)))

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

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

.addComponent(SchoolText1, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(FirstNameText1, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(TelText1, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(ThirdNameText1, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(NameText1, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGroup(jPanel1Layout.createSequentialGroup()

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

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

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

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

.addComponent(Year))))

.addGroup(jPanel1Layout.createSequentialGroup()

.addComponent(AddKid)

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

.addComponent(jButton1)))

.addContainerGap(20, Short.MAX_VALUE))

);

jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {FirstNameText1, NameText1, SchoolText1, TelText1, ThirdNameText1, jScrollPane1});

jPanel1Layout.setVerticalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

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

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

.addComponent(jLabel4)

.addComponent(FirstNameText1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

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

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

.addComponent(jLabel9)

.addComponent(NameText1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

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

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

.addComponent(jLabel10)

.addComponent(ThirdNameText1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

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

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

.addComponent(TelText1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel2))

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

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

.addComponent(jLabel7)

.addComponent(Day, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(Mounth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(Year, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

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

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

.addComponent(jLabel8)

.addComponent(SchoolText1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

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

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

.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel1))

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

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

.addComponent(jButton1)

.addComponent(AddKid))

.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, 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()

.addContainerGap()

.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)

.addGroup(layout.createSequentialGroup()

.addContainerGap()

.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))

);

getAccessibleContext().setAccessibleName("");

pack();

}// </editor-fold>

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

try {

String url = "jdbc:derby://localhost:1527/admin";

String username = "Nikita";

String password = "909878";

Connection con = DriverManager.getConnection(url,username,password);

Statement stmt = con.createStatement();

String subj = subj.getText();

String date = date .getText();

String time = time.getText();

String teacher = teacher.getText();

String student = student.getText();

String problem = ProblemsText1.getText();

subj = subj.replaceAll("\\s", "");

date = date.replaceAll("\\s", "");

time = time.replaceAll("\\s", "");

teacher = teacher.replaceAll("\\s", "");

student = problem.replaceAll("\\s", "");

String date = Day.getText() + "." + Mounth.getText() + "." + Year.getText();

String time = hour + "." + min;

Addition add = new Addition();

add.addLesson(subj, date, time, teacher, student);

subj.setText(null);

hours.setText(null);

min.setText(null);

teacher.setText(null);

student.setText(null);

Mounth.setText(null);

Year.setText(null);

day.setText(null);

}

catch(SQLException ex){

JOptionPane.showMessageDialog(null, ex.toString());

}

}

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

Viev v = new Viev();

v.setVisible(true);

v.toFront();

}

public static int getResultSetRowCount(ResultSet resultSet) {

int size = 0;

try {

resultSet.last();

size = resultSet.getRow();

resultSet.beforeFirst();

}

catch(SQLException ex) {

return 0;

}

return size;

}

/**

* @param args the command line arguments

*/

public static void main(String args[]) {

/* Set the Nimbus look and feel */

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

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

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

*/

try {

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

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

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

break;

}

}

} catch (ClassNotFoundException ex) {

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

} catch (InstantiationException ex) {

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

} catch (IllegalAccessException ex) {

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

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

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

}

//</editor-fold>

/* Create and display the form */

java.awt.EventQueue.invokeLater(() -> {

new Kids().setVisible(true);

});

}

Приложение P. Исходный код

Листинг файла VievTeacher.java

package kids;

import java.util.*;

import javax.swing.*;

import java.sql.*;

import javax.swing.JOptionPane;

public class Kids extends javax.swing.JFrame {

public VievTeacher() {

initComponents();

for (int i = 1900; i < 2016; i++){

}

}

/**

* 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.

*/

@SuppressWarnings("unchecked")

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

private void initComponents() {

jPanel1 = new javax.swing.JPanel();

FirstNameText1 = new javax.swing.JTextField();

NameText1 = new javax.swing.JTextField();

ThirdNameText1 = new javax.swing.JTextField();

jLabel4 = new javax.swing.JLabel();

jLabel9 = new javax.swing.JLabel();

jLabel10 = new javax.swing.JLabel();

TelText1 = new javax.swing.JTextField();

jLabel2 = new javax.swing.JLabel();

jLabel7 = new javax.swing.JLabel();

SchoolText1 = new javax.swing.JTextField();

jLabel8 = new javax.swing.JLabel();

AddKid = new javax.swing.JButton();

jScrollPane1 = new javax.swing.JScrollPane();

ProblemsText1 = new javax.swing.JTextPane();

jLabel1 = new javax.swing.JLabel();

jButton1 = new javax.swing.JButton();

Day = new javax.swing.JTextField();

Mounth = new javax.swing.JTextField();

Year = new javax.swing.JTextField();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setTitle("Добавление ребенка");

jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Заполнение таблицы", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Times New Roman", 1, 16))); // NOI18N

jPanel1.setDoubleBuffered(false);

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

jLabel4.setText("Фамилия:");

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

jLabel9.setText("Имя:");

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

jLabel10.setText("Отчество:");

TelText1.setText(" ");

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

jLabel2.setText("Телефон:");

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

jLabel7.setText("Дата рождения:");

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

jLabel8.setText("Номер школы:");

AddKid.setText("Добавить");

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

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

AddKidActionPerformed(evt);

}

});

jScrollPane1.setViewportView(ProblemsText1);

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

jLabel1.setText("Проблема:");

jButton1.setText("Показать ");

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

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

jButton1ActionPerformed(evt);

}

});

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

jPanel1.setLayout(jPanel1Layout);

jPanel1Layout.setHorizontalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel1Layout.createSequentialGroup()

.addContainerGap()

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)


Подобные документы

  • Процесс разработки базы данных для хранения и обработки информации. Ключи, индексы, триггеры, хранимые процедуры. Разработка пользовательского интерфейса и базы данных. Основные инструментальные средства для разработки клиентской и серверной частей.

    дипломная работа [225,0 K], добавлен 18.05.2013

  • Разработка программы, создающей и управляющей базой данных, ее реализация на языке Turbo Pascal. Организация алгоритма программы. Вывод информации и возможность добавления информации в базу данных. Поиск информации в базе данных по заданному значению.

    курсовая работа [26,7 K], добавлен 19.06.2010

  • Проведение системного анализа предметной области и разработка проекта по созданию базы данных для хранения информации о перевозках пассажиров и грузов. Обоснование выбора системы управления базой данных и разработка прикладного программного обеспечения.

    курсовая работа [1,1 M], добавлен 18.07.2014

  • Основные виды баз данных. Система управления базами данных. Анализ деятельности и информации, обрабатываемой в поликлинике. Состав таблиц в базе данных и их взаимосвязи. Методика наполнения базы данных информацией. Алгоритм создания базы данных.

    курсовая работа [3,1 M], добавлен 17.12.2014

  • Методика разработки программы по поиску информации из базы данных, содержащей информацию о телевизорах. Использование языка программирования "С++" и среды разработки Qt Creator "С++" - статически типизированного языка программирования общего назначения.

    курсовая работа [626,1 K], добавлен 22.12.2011

  • Разработка web-приложения для оперирования данными с помощью базы данных и web-браузера в качестве клиента пользователя. Основные преимущества языка программирования Java. Осуществление редактирования, добавления информации и поиска по архивам данных.

    дипломная работа [2,1 M], добавлен 30.09.2016

  • Разработка информационно-аналитической системы агентства недвижимости. Обоснование выбора архитектуры базы данных и СУБД. Моделирование потоков данных (DFD диаграмм). Проектирование инфологической модели данных с использованием модели "сущность-связь".

    дипломная работа [5,4 M], добавлен 06.06.2013

  • Автоматизированные базы данных в учебном процессе. Создание базы данных для МОУ СОШ № 12 с целью помощи в обеспечении централизованного управления, хранения информации об учениках. Требования к программе, условия эксплуатации. Программный код базы данных.

    дипломная работа [2,0 M], добавлен 25.03.2014

  • Теоретические аспекты СУБД. Основные понятия. Функциональные возможности СУБД. Архитектура систем управления. Разработка базы данных. Крупные массивы данных размещают, как правило, отдельно от исполняемого программы, и организуют в виде базы данных.

    курсовая работа [30,5 K], добавлен 23.02.2006

  • Виды связей между объектами в системе управления базами данных MS Access. Ввод и редактирование данных в таблицах, обработка информации базы данных. Архитектура БД по принципу файл-сервер. Создания формы в окне базы данных, использование отчетов.

    презентация [511,9 K], добавлен 20.01.2014

Работы в архивах красиво оформлены согласно требованиям ВУЗов и содержат рисунки, диаграммы, формулы и т.д.
PPT, PPTX и PDF-файлы представлены только в архивах.
Рекомендуем скачать работу.