Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Kursova_Java.doc
Скачиваний:
0
Добавлен:
01.07.2025
Размер:
3.73 Mб
Скачать

Висновки

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

Тестування програми показало відповідність її вимогам, тому що набір спочатку поставлених завдань виконується на необхідному рівні. Модульне тестування показало, що окремі функції повністю працездатні і не призводять до регресії програми.

Під час виконання курсового проекту було зроблено висновок, що даний програмний продукт може використовуватись людьми у домашніх умовах, на персональному комп’ютері без звязку з мережею інтернет.

Під час написання курсового проекту виникали деякі помилки з додаванням інформації у базу даних, але вони були успішно подолані завдяки широкому вибору інформації в просторі Інтернету.

Мета даної роботи була досягнена.

Список використаної літератури

  1. http://preparat.org.uaГруппа 231

  2. http://osteo.com.ua

  3. http://pregnets.pp.ua/?p=106

  4. https://uk.wikipedia.org/wiki/NetBeans ;

  5. https://www.youtube.com/watch?v=78PCIp2bSEk;

  6. В. Монахов «Язык программирования Java и среда NetBeans»

  7. Java. Полное руководство, 8-е издание. Герберт Шилдт

  8. Java. Эффективное программирование Автор: Джошуа Блох

  9. Знакомьтесь: Java. Самоучитель Автор: Е. Е. Аккуратов

  10. Крупник А. Изучаем Java. Питер.2004

  11. Крупник А. Самоучитель Java. Питер.2005

  12. Кубенский. Структуры и алгоритмы обработки данных, объектно-ориентированный подход и реализация на Java.БХВ

  13. JDBC Java и Базы даных. Лори 324стр

  14. Культин Н. С Java в задачах и примерах.БХВ.2005

Додаток 1. Лістинг

import java.awt.Color;

import java.awt.Dimension;

import java.awt.HeadlessException;

import java.awt.Toolkit;

import static java.awt.image.ImageObserver.WIDTH;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.ResultSetMetaData;

import java.sql.SQLException;

import java.sql.Statement;

import java.util.Properties;

import java.util.logging.Level;

import java.util.logging.Logger;

import javax.swing.JOptionPane;

public class JAuthorization extends javax.swing.JFrame {

/**

* Creates new form JAuthorization

*/

public JAuthorization() {

initComponents();

Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();

this.setLocation(dim.width/2-this.getSize().width/2, dim.height/2-this.getSize().height/2);

this.getContentPane().setBackground(new Color(205,175,192));

this.setTitle("Авторизація");

// підєднуємося до бази даних

try {

String sIP = "127.0.0.1";

String sDatabase ="doctor_db";

String sRoot = "root";

String sPass ="";

Properties p = new Properties();

p.setProperty("user",sRoot);

p.setProperty("password",sPass);

// налаштовуємо вивід тексту з кодуванням кирилиці

p.setProperty("useUnicode","true");

p.setProperty("characterEncoding","cp1251");

Class.forName("com.mysql.jdbc.Driver");

JMain.con = DriverManager.getConnection("jdbc:mysql://" + sIP + "/" + sDatabase,p);

// SearchData("");

} catch (ClassNotFoundException ex) {

JOptionPane.showMessageDialog(null, "Проблема в підключенні: " + ex);

} catch (SQLException ex) {

JOptionPane.showMessageDialog(null, "Проблема в підключенні: " + ex);

Logger.getLogger(JMain.class.getName()).log(Level.SEVERE, null, ex);

}Группа 548

/**

* 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() {

jLabel1 = new javax.swing.JLabel();

jLabel2 = new javax.swing.JLabel();

txtLogin = new javax.swing.JTextField();

txtPass = new javax.swing.JTextField();

btExit = new javax.swing.JButton();

btEnter = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setResizable(false);

jLabel1.setText("Логін");

jLabel2.setText("Пароль");

btExit.setText("Вихід");

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

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

btExitActionPerformed(evt);

}

});

btEnter.setText("Увійти");

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

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

btEnterActionPerformed(evt);

}

});

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

getContentPane().setLayout(layout);

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

.addGroup(layout.createSequentialGroup()

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

.addGroup(layout.createSequentialGroup()

.addGap(0, 0, Short.MAX_VALUE)

.addComponent(btEnter)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.

RELATED)

.addComponent(btExit))

.addGroup(layout.createSequentialGroup()

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

.addComponent(jLabel2)

.addComponent(jLabel1))

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

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

.addComponent(txtLogin)

.addComponent(txtPass, javax.swing.GroupLayout.DEFAULT_SIZE, 274, Short.MAX_VALUE))))

.addContainerGap())

);

layout.setVerticalGroup(

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

.addGroup(layout.createSequentialGroup()

.addGap(10, 10, 10)

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

.addComponent(jLabel1)

.addComponent(txtLogin, 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.BASELINE)

.addComponent(jLabel2)

.addComponent(txtPass, 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.BASELINE)

.addComponent(btExit)

.addComponent(btEnter))

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

);

pack();

}// </editor-fold>

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

Runtime.getRuntime().halt(0);

}

btEnterActionPerformed(java.awt.event.ActionEvent evt) {

String r1 = null;

String r2 = null;

String sql = "SELECT * FROM tb_authorization WHERE id=1";

try {

Группа 1069

try (Statement stmt = JMain.con.createStatement(); ResultSet rs = stmt.executeQuery(sql)) {

ResultSetMetaData rsmd = rs.getMetaData();

int columnCount = rsmd.getColumnCount();

while (rs.next()) {

r1 = rs.getString("login");

r2 = rs.getString("password");

}

if (txtLogin.getText().equals(r1))

{

if (txtPass.getText().equals(r2))

{

JMain.main(null);

this.dispose();

}

else

{

JOptionPane.showMessageDialog(this, "Введіть правильний пароль", "Помилка", WIDTH, null);

}

}

else

{

JOptionPane.showMessageDialog(this, "Введіть правильний логін", "Помилка", WIDTH, null);

}

}

} catch (SQLException | HeadlessException ex) {

JOptionPane.showMessageDialog(this, ex, ex.getMessage(), WIDTH, null);

}

}

/**

* @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(JAuthorization.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(JAuthorization.class.getName(

)).log(java.util.logging.Level.SEVERE, null, ex); Группа 589

} catch (IllegalAccessException ex) {

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

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(JAuthorization.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 JAuthorization().setVisible(true);

}

import java.awt.Color;

import java.awt.Dimension;

import java.awt.Point;

import java.awt.Toolkit;

import static java.awt.image.ImageObserver.WIDTH;

import java.sql.Connection;

import java.sql.PreparedStatement;

import java.sql.ResultSet;

import java.sql.ResultSetMetaData;

import java.sql.SQLException;

import java.sql.Statement;

import java.util.logging.Level;

import java.util.logging.Logger;

import javax.swing.JOptionPane;

import javax.swing.JTable;

import javax.swing.table.DefaultTableModel;

public class JMain extends javax.swing.JFrame {

public static Connection con = null;

public static String sTable = "tb_drugs"; //**************************************************************//

// очищує таблицю

//**************************************************************//

private void ClearTable()

{

DefaultTableModel model = (DefaultTableModel) jTable1.getModel();

for( int i = model.getRowCount() - 1; i >= 0; i-- )

{

model.removeRow(i);

}

} //**************************************************************//

// вивід типу препарату

//****************************************************

**********//

private String GetTypeByName(String sName)

{

String result = null;

String sql = "SELECT * FROM " + sTable + " WHERE drugname like '" + sName + "'";

try {

try (Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(sql)) {

// отримуємо інформацію з колонки

ResultSetMetaData rsmd = rs.getMetaData();

int columnCount = rsmd.getColumnCount();

// дадаємо препарати з бази даних до нашої таблиці

while (rs.next()) {

result = rs.getString(4);

}

}

} catch (Exception ex) {

JOptionPane.showMessageDialog(this, ex, ex.getMessage(), WIDTH, null);

}

return result;

}

//**************************************************************//

// вивід інформації про препарат

//**************************************************************//

private String GetInfoByDrugName(String sName)

{

String result = null;

String sql = "SELECT * FROM " + sTable + " WHERE drugname like '" + sName + "'";

try {

try (Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(sql)) {

// отримуємо інформацію з колонки

ResultSetMetaData rsmd = rs.getMetaData();

int columnCount = rsmd.getColumnCount();

// дадаємо препарати з бази даних до нашої таблиці

while (rs.next()) {

result = rs.getString(3);

}

}

} catch (Exception ex) {

JOptionPane.showMessageDialog(this, ex, ex.getMessage(), WIDTH, null);

}

return result;

}

//**************************************************************//

//

//**************************************************************//

private String GetFormbyDrugName(String sName)

{

String result = null;

String sql = "SELECT * FROM " + sTable + " WHERE drugname like '" + sName + "'";

try {

try (Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(sql)) {

// отримуємо інформацію з колонки

ResultSetMetaData rsmd = rs.getMetaData();

int columnCount = rsmd.getColumnCount();

// дадаємо препарати з бази даних до нашої таблиці

while (rs.next()) {

result = rs.getString(5);

}

}

} catch (Exception ex) {

JOptionPane.showMessageDialog(this, ex, ex.getMessage(), WIDTH, null);

}

return result;

}

//**************************************************************//

//

//**************************************************************//

private String GetEffectbyDrugName(String sName)

{

String result = null;

String sql = "SELECT * FROM " + sTable + " WHERE drugname like '" + sName + "'";

try {

try (Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(sql)) {

// отримуємо інформацію з колонки

ResultSetMetaData rsmd = rs.getMetaData();

int columnCount = rsmd.getColumnCount();

// дадаємо препарати з бази даних до нашої таблиці

while (rs.next()) {

result = rs.getString(6);

}

Группа 631

}

} catch (Exception ex) {

JOptionPane.showMessageDialog(this, ex, ex.getMessage(), WIDTH, null);

}

return result;

}

//**************************************************************//

//

//**************************************************************//

private String GetSaveDrugName(String sName)

{

String result = null;

String sql = "SELECT * FROM " + sTable + " WHERE drugname like '" + sName + "'";

try {

try (Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(sql)) {

// отримуємо інформацію з колонки

ResultSetMetaData rsmd = rs.getMetaData();

int columnCount = rsmd.getColumnCount();

// дадаємо препарати з бази даних до нашої таблиці

while (rs.next()) {

result = rs.getString(7);

}

}

} catch (Exception ex) {

JOptionPane.showMessageDialog(this, ex, ex.getMessage(), WIDTH, null);

}

return result;

}

//**************************************************************//

// вивід інформації про препарат

//**************************************************************//

private int GetID(String sName, String sInfo)

{

int result = 0;

String sql = "SELECT * FROM " + sTable + " WHERE drugname like '" + sName + "' AND druginfo like '" + sInfo + "'";

try {

try (Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(sql)) {

// отримуємо інформацію з колонки

ResultSetMetaData rsmd = rs.getMetaData();

int columnCount = rsmd.getColumnCount();

// дадаємо препарати з бази даних до нашої таблиці

while (rs.next()) {

result = rs.getInt(1);

}

}

} catch (Exception ex) {

JOptionPane.showMessageDialog(this, ex, ex.getMessage(), WIDTH, null);

}

return result;

}

//**************************************************************//

// пошук даних в списку препаратів

//**************************************************************//

public void SearchData(String srchArg, String strArg2)

{

ClearTable();

String sql = "SELECT * FROM " + sTable + " WHERE drugname like '" + srchArg + "%' AND drugtype like '" + strArg2 + "%'";

try {

try (Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(sql)) {

// отримуємо інформацію з колонки

ResultSetMetaData rsmd = rs.getMetaData();

int columnCount = rsmd.getColumnCount();

DefaultTableModel tm = (DefaultTableModel) jTable1.getModel();

// очищаємо таблицю

ClearTable();

// дадаємо препарати з бази даних до нашої таблиці

while (rs.next()) {

String[] a = new String[columnCount];

for(int i = 1; i < columnCount; i++) {

a[i-1] = rs.getString(i+1);

}

tm.addRow(a);

}

tm.fireTableDataChanged();

// забороняємо зміну полів таблиці в реальному часі

for (int c = 0; c < tm.getColumnCount(); c++)

{

Class<?> col_class = tm.getColumnClass(c);

jTable1.setDefaultEditor(col_class, null);

}

}

} catch (Exception ex) {

Группа 652

JOptionPane.showMessageDialog(this, ex, ex.getMessage(), WIDTH, null);

}

}

//**************************************************************//

// пошук даних в списку препаратів по алфавіту

//**************************************************************//

private void SearchAlphabetic(Character srchArg)

{

SearchData(srchArg.toString(), "");

}

// ***************************************************************************************************** //

public JMain() {

initComponents();

Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();

this.setLocation(dim.width/2-this.getSize().width/2, dim.height/2-this.getSize().height/2);

this.getContentPane().setBackground(new Color(205,175,192));

this.setTitle("Довідник лікаря");

}

@SuppressWarnings("unchecked")

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

private void initComponents() {

buttonGroup1 = new javax.swing.ButtonGroup();

txtSearch = new javax.swing.JTextField();

jLabel1 = new javax.swing.JLabel();

jButton1 = new javax.swing.JButton();

jScrollPane1 = new javax.swing.JScrollPane();

jTable1 = new javax.swing.JTable();

jButton2 = new javax.swing.JButton();

jButton3 = new javax.swing.JButton();

jButton5 = new javax.swing.JButton();

jButton6 = new javax.swing.JButton();

jLabel2 = new javax.swing.JLabel();

jLabel3 = new javax.swing.JLabel();

jLabel4 = new javax.swing.JLabel();

jLabel5 = new javax.swing.JLabel();

jLabel6 = new javax.swing.JLabel();

jLabel7 = new javax.swing.JLabel();

jLabel8 = new javax.swing.JLabel();

jLabel9 = new javax.swing.JLabel();

jLabel10 = new javax.swing.JLabel();

jLabel11 = new javax.swing.JLabel();

jLabel12 = new javax.swing.JLabel();

jLabel13 = new javax.swing.JLabel();

jLabel14 = new javax.swing.JLabel();

jLabel15 = new javax.swing.JLabel();

jLabel16 = new javax.swing.JLabel();

jLabel17 = new javax.swing.JLabel();

jLabel18 = new javax.swing.JLabel();

jLabel19 = new javax.swing.JLabel();

jLabel20 = new javax.swing.JLabel();

jLabel21 = new javax.swing.JLabel();

jLabel22 = new javax.swing.JLabel();

jLabel23 = new javax.swing.JLabel();

jLabel24 = new javax.swing.JLabel();

jLabel25 = new javax.swing.JLabel();

jLabel26 = new javax.swing.JLabel();

jLabel27 = new javax.swing.JLabel();

jLabel28 = new javax.swing.JLabel();

jLabel29 = new javax.swing.JLabel();

jLabel30 = new javax.swing.JLabel();

jLabel31 = new javax.swing.JLabel();

jLabel32 = new javax.swing.JLabel();

jLabel33 = new javax.swing.JLabel();

cbDrugType = new javax.swing.JComboBox();

jLabel34 = new javax.swing.JLabel();

jButton7 = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setResizable(false);

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

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

txtSearchActionPerformed(evt);

}

});

jLabel1.setText("Введіть назву препарату");

jButton1.setText("Пошук");

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

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

jButton1ActionPerformed(evt);

}

});

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

new Object [][] {

},

new String [] {

"Список препаратів"

}

));

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

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

jTable1MousePressed(evt);

}

});

jScrollPane1.setViewportView(jTable1);

jButton2.setText("Додати препарат");

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

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

Группа 693 jButton2ActionPerformed(evt);

}

});

jButton3.setText("Видалити препарат");

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

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

jButton3ActionPerformed(evt);

}

});

jButton5.setText("Про програму");

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

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

jButton5ActionPerformed(evt);

}

});

jButton6.setText("Вивід всього списку препаратів");

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

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

jButton6ActionPerformed(evt);

}

});

jLabel2.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel2.setText("Б");

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

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

jLabel2MouseClicked(evt);

}

});

jLabel3.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel3.setText("В");

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

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

jLabel3MouseClicked(evt);

}

});

jLabel4.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel4.setText("А");

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

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

jLabel4MouseClicked(evt);

}

});

jLabel5.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel5.setText("Ґ");

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

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

jLabel5MouseClicked(evt);

}

});

jLabel6.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel6.setText("Д");

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

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

jLabel6MouseClicked(evt);

}

});

jLabel7.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel7.setText("Г");

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

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

jLabel7MouseClicked(evt);

}

});

jLabel8.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel8.setText("Є");

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

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

jLabel8MouseClicked(evt);

}

});

jLabel9.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel9.setText("Ж");

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

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

jLabel9MouseClicked(evt);

}

});

jLabel10.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel10.setText("Е");

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

public void mouseClicked(java.awt.event.MouseEvent evt) Группа 749

{

jLabel10MouseClicked(evt);

}

});

jLabel11.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel11.setText("И");

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

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

jLabel11MouseClicked(evt);

}

});

jLabel12.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel12.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel12.setText("І");

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

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

jLabel12MouseClicked(evt);

}

});

jLabel13.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel13.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel13.setText("З");

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

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

jLabel13MouseClicked(evt);

}

});

jLabel14.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel14.setHorizontalAlignment(javax.swing.SwingConstants.C

ENTER);

jLabel14.setText("Й");

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

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

jLabel14MouseClicked(evt);

}

});

jLabel15.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel15.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel15.setText("К");

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

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

jLabel15MouseClicked(evt);

}

});

jLabel16.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel16.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel16.setText("Ї");

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

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

jLabel16MouseClicked(evt);

}

});

jLabel17.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel17.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel17.setText("Н");

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

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

jLabel17MouseClicked(evt);

}

});

jLabel18.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel18.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel18.setText("С");

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

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

jLabel18MouseClicked(evt);

}

});

jLabel19.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel19.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel19.setText("Т");

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

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

jLabel19MouseClicked(evt);

}

});

jLabel20.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel20.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel20.setText("Р");

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

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

jLabel20MouseClicked(evt);

}

});

jLabel21.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel21.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel21.setText("Ф");

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

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

jLabel21MouseClicked(evt);

}

});

jLabel22.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel22.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel22.setText("Х");

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

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

jLabel22MouseClicked(evt);

}

});

jLabel23.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel23.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel23.setText("У");

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

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

jLabel23MouseClicked(evt);

}

});

jLabel24.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

Группа 332

jLabel24.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel24.setText("Л");

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

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

jLabel24MouseClicked(evt);

}

});

jLabel25.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel25.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel25.setText("М");

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

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

jLabel25MouseClicked(evt);

}

});

jLabel26.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel26.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel26.setText("О");

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

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

jLabel26MouseClicked(evt);

}

});

jLabel27.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel27.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel27.setText("П");

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

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

jLabel27MouseClicked(evt);

}

});

jLabel28.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel28.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel28.setText("Ц");

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

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

jLabel28MouseClicked(evt);

}

});

Группа 769

jLabel29.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel29.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel29.setText("Ш");

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

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

jLabel29MouseClicked(evt);

}

});

jLabel30.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel30.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel30.setText("Щ");

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

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

jLabel30MouseClicked(evt);

}

});

jLabel31.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel31.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel31.setText("Ч");

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

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

jLabel31MouseClicked(evt);

}

});

jLabel32.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel32.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel32.setText("Я");

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

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

jLabel32MouseClicked(evt);

}

});

jLabel33.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel33.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel33.setText("Ю");

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

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

jLabel33MouseClicked(evt)

}

});

cbDrugType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Всі типи",

Группа 392

"Антибіотики", "Анальгетики", "Антисептики", "Імуностимулятори", "Лікарські рослини", "Наркотики", " " }));

jLabel34.setText("Виберіть тип препарату:");

jLabel34.setToolTipText("");

jButton7.setText("Налаштування");

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

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

jButton7ActionPerformed(evt);

}

});

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

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

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

.addGroup(layout.createSequentialGroup()

.addContainerGap()

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

.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING)

.addGroup(layout.createSequentialGroup()

.addComponent(jLabel1)

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

.addComponent(txtSearch)

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

.addComponent(jLabel34)

.addGap(4, 4, 4)

.addComponent(cbDrugType, javax.swing.GroupLayout.PREFERRED_SIZE, 309, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(layout.createSequentialGroup()

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

.addGroup(layout.createSequentialGroup()

.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(layout.createSequentialGroup()

.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE)

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

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

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

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

.addGroup(layout.createSequentialGroup()

.addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel24, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel26, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel27, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel18,

javax.swing.GroupLayout.PREFERRED_SIZE, 30,

Группа 789

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

.addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel23, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel28, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel31, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(2, 2, 2)

.addComponent(jLabel29, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel30, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel33, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jLabel32, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(layout.createSequentialGroup()

.addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 276, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jButton7,

javax.swing.GroupLayout.PREFERRED_SIZE, 251, javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.

RELATED)

.addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE)))

.addGap(0, 0, Short.MAX_VALUE)))

.addContainerGap())

);

layout.setVerticalGroup(

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

.addGroup(layout.createSequentialGroup()

.addContainerGap()

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

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

.addComponent(jLabel1)

.addComponent(jButton1)

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

.addComponent(jLabel34))

.addGap(5, 5, 5)

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

.addComponent(jButton2)

.addComponent(jButton3)

.addComponent(jButton5)

.addComponent(jButton6)

.addComponent(jButton7))

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

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

.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 28,

javax.swing.GroupLayout.PREFERRED_SIZE) Группа 809

.addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel24, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel26, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel27, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel23, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel28, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel29, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel30, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel31,

javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel33, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel32, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))

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

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

);

pack();

}// </editor-fold>

//**************************************************************//

// додає нову строку до таблиці

//**************************************************************//

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

jAdd.main(null);

}

//**************************************************************//

// видаляє виділену строку з таблиці

//**************************************************************//

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

DefaultTableModel model = (DefaultTableModel) jTable1.getModel();

int fnd = jTable1.getSelectedRow();

String sName = (String)jTable1.getModel().getValueAt(fnd, 0);

// видаляємо рядок з таблиці

model.removeRow(jTable1.convertRowIndexToModel(fnd));

// видаляємс препарат з бази даних

try

{

String sql = "DELETE FROM " + sTable + " WHERE drugname = ?";

PreparedStatement preparedStmt = con.prepareStatement(sql);

preparedStmt.setString(1, sName);

preparedStmt.execute();

}

catch (SQLException ex) {

JOptionPane.showMessageDialog(null, "Помилка при видаленні: " + ex);

Logger.getLogger(JMain.class.getName()).log(Level.SEVERE, null, ex);

}

}

Группа 829

//**************************************************************//

// вивід інформації про програму

//**************************************************************//

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

JOptionPane.showMessageDialog(null, "Програму створив студент групи КН-32, Феделеш В'ячислав", null, WIDTH, null);

}

//**************************************************************//

// пошук інформації

//**************************************************************//

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

if (cbDrugType.getSelectedItem().toString() == "Всі типи")

{

SearchData(txtSearch.getText(),"");

}

else

{

SearchData(txtSearch.getText(),cbDrugType.getSelectedItem().toString());

}

}

//**************************************************************//

// вивід всього списку препаратів

//**************************************************************//

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

SearchData("", "");

}

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

// TODO add your handling code here:

}

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

SearchAlphabetic('А');

}

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

SearchAlphabetic('Б');

}

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

SearchAlphabetic('В');

}

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

SearchAlphabetic('Г');

}

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

SearchAlphabetic('Ґ');

}

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

SearchAlphabetic('Д');

}

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

SearchAlphabetic('Е');

}

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

SearchAlphabetic('Є');

}

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

SearchAlphabetic('Ж');

}

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

SearchAlphabetic('З');

}

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

SearchAlphabetic('И');

}

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

SearchAlphabetic('І');

}

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

SearchAlphabetic('Ї');

}

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

SearchAlphabetic('Й');

}

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

SearchAlphabetic('К');

}

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

SearchAlphabetic('Л');

}

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

SearchAlphabetic('М');

}

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

SearchAlphabetic('Н');

}

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

SearchAlphabetic('О');

}

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

SearchAlphabetic('П');

}

private void jLabel20MouseClicked(java.awt.event.MouseEvent

evt) {

SearchAlphabetic('Р');

} Группа 849

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

SearchAlphabetic('С');

}

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

SearchAlphabetic('Т');

}

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

SearchAlphabetic('У');

}

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

SearchAlphabetic('Ф');

}

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

SearchAlphabetic('Х');

}

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

SearchAlphabetic('Ц');

}

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

SearchAlphabetic('Ч');

}

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

SearchAlphabetic('Ш');

}

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

SearchAlphabetic('Щ');

}

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

SearchAlphabetic('Ю');

}

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

SearchAlphabetic('Я');

}

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

JTable table =(JTable) evt.getSource();

Point p = evt.getPoint();

int row = table.rowAtPoint(p);

if (evt.getClickCount() == 2) {

int fnd = jTable1.getSelectedRow();

String sName = (String)jTable1.getModel().getValueAt(fnd, 0);

jDrugInfo.strType = GetTypeByName(sName);

jDrugInfo.strInfo = GetInfoByDrugName(sName);

jDrugInfo.strForm = GetFormbyDrugName(sName);

jDrugInfo.strEffects = GetEffectbyDrugName(sName);

jDrugInfo.strSave = GetSaveDrugName(sName);

jDrugInfo.strName = sName;

jDrugInfo.iId = GetID(sName, jDrugInfo.strInfo);

jDrugInfo.main(null);

}

}

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

JSettings.main(null);

}

/**

* @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(JMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (InstantiationException ex) {

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

} catch (IllegalAccessException ex) {

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

} catch (javax.swing.UnsupportedLookAndFeelException ex) Группа 869

{ java.util.logging.Logger.getLogger(JMain.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 JMain().setVisible(true);

}

});

}

// Variables declaration - do not modify

private javax.swing.ButtonGroup buttonGroup1;

private javax.swing.JComboBox cbDrugType;

private javax.swing.JButton jButton1;

private javax.swing.JButton jButton2;

private javax.swing.JButton jButton3;

private javax.swing.JButton jButton5;

private javax.swing.JButton jButton6;

private javax.swing.JButton jButton7;

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel10;

private javax.swing.JLabel jLabel11;

private javax.swing.JLabel jLabel12;

private javax.swing.JLabel jLabel13;

private javax.swing.JLabel jLabel14;

private javax.swing.JLabel jLabel15;

private javax.swing.JLabel jLabel16;

private javax.swing.JLabel jLabel17;

private javax.swing.JLabel jLabel18;

private javax.swing.JLabel jLabel19;

private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel20;

private javax.swing.JLabel jLabel21;

private javax.swing.JLabel jLabel22;

private javax.swing.JLabel jLabel23;

private javax.swing.JLabel jLabel24;

private javax.swing.JLabel jLabel25;

private javax.swing.JLabel jLabel26;

private javax.swing.JLabel jLabel27;

private javax.swing.JLabel jLabel28;

private javax.swing.JLabel jLabel29;

private javax.swing.JLabel jLabel3;

private javax.swing.JLabel jLabel30;

private javax.swing.JLabel jLabel31;

private javax.swing.JLabel jLabel32;

private javax.swing.JLabel jLabel33;

private javax.swing.JLabel jLabel34;

private javax.swing.JLabel jLabel4;

private javax.swing.JLabel jLabel5;

private javax.swing.JLabel jLabel6;

private javax.swing.JLabel jLabel7;

private javax.swing.JLabel jLabel8;

private javax.swing.JLabel jLabel9;

private javax.swing.JScrollPane jScrollPane1;

private javax.swing.JTable jTable1;

private javax.swing.JTextField txtSearch;

// End of variables declaration

}

});

}

// Variables declaration - do not modify

private javax.swing.JButton btEnter;

private javax.swing.JButton btExit;

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel2;

private javax.swing.JTextField txtLogin;

private javax.swing.JTextField txtPass;

// End of variables declaration

}

import java.awt.Color;

import java.awt.Dimension;

import java.awt.Toolkit;

import java.sql.PreparedStatement;

import java.sql.SQLException;

import java.util.logging.Level;

import java.util.logging.Logger;

import javax.swing.JOptionPane;

public class JSettings extends javax.swing.JFrame {

/**

* Creates new form JSettings

*/

public JSettings() {

initComponents();

Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();

this.setLocation(dim.width/2-this.getSize().width/2, dim.height/2-this.getSize().height/2);

this.getContentPane().setBackground(new Color(205,175,192));

this.setTitle("Налаштування");

}

/**

* 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() {

jLabel1 = new javax.swing.JLabel();

jLabel2 = new javax.swing.JLabel();

txtLogin = new javax.swing.JTextField();

txtPass = new javax.swing.JTextField();

btExit = new javax.swing.JButton();

btEnter = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

setResizable(false);

jLabel1.setText("Логін");

jLabel2.setText("Пароль");

btExit.setText("Вихід");

btExit.addActionListener(new Группа 889

java.awt.event.ActionListener() {

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

btExitActionPerformed(evt);

}

});

btEnter.setText("Зберегти");

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

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

btEnterActionPerformed(evt);

}

});

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

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

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

.addGroup(layout.createSequentialGroup()

.addContainerGap()

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

.addGroup(layout.createSequentialGroup()

.addComponent(jLabel1)

.addGap(26, 26, 26)

.addComponent(txtLogin))

.addGroup(layout.createSequentialGroup()

.addComponent(jLabel2)

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

.addComponent(txtPass, javax.swing.GroupLayout.DEFAULT_SIZE, 329, Short.MAX_VALUE))

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

.addGap(0, 0, Short.MAX_VALUE)

.addComponent(btEnter)

.addGap(11, 11, 11)

.addComponent(btExit, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)))

.addContainerGap())

);

layout.setVerticalGroup(

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

.addGroup(layout.createSequentialGroup()

.addGap(10, 10, 10)

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

.addComponent(jLabel1)

.addComponent(txtLogin, 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.BASELINE)

.addComponent(jLabel2)

.addComponent(txtPass, 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.BASELINE)

.addComponent(btEnter)

.addComponent(btExit))

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

);

pack();

}// </editor-fold>

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

this.dispose();

}

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

String sql = "UPDATE tb_authorization SET login = ?, password = ? WHERE id = 1";

try {

PreparedStatement pst = JMain.con.prepareStatement(sql);

pst.setString(1, txtLogin.getText());

pst.setString(2, txtPass.getText());

pst.executeUpdate();

} catch(SQLException ex) {

JOptionPane.showMessageDialog(null, "Помилка: " + ex);

Logger.getLogger(JSettings.class.getName()).log(Level.SEVERE, null, ex);

}

this.dispose();

}

/**

* @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; Группа 909

}

}

} catch (ClassNotFoundException ex) {

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

} catch (InstantiationException ex) {

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

} catch (IllegalAccessException ex) {

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

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(JSettings.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 JSettings().setVisible(true);

}

});

}

// Variables declaration - do not modify

private javax.swing.JButton btEnter;

private javax.swing.JButton btExit;

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel2;

private javax.swing.JTextField txtLogin;

private javax.swing.JTextField txtPass;

// End of variables declaration

}

import java.awt.Dimension;

import java.awt.Toolkit;

import java.sql.PreparedStatement;

import java.sql.SQLException;

import java.util.logging.Level;

import java.util.logging.Logger;

import javax.swing.JOptionPane;

import javax.swing.JTable;

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

/**

*

* @author 1

*/

public class jAdd extends javax.swing.JFrame {

public static JTable tblList;

/**

* Creates new form jAdd

*/

public jAdd() {

initComponents();

// відцентровуємо форму

Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();

this.setLocation(dim.width/2-this.getSize().width/2, dim.height/2-this.getSize().height/2);

this.setTitle("Введіть інформацію про препарат");

}

/**

* 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() {

jButton3 = new javax.swing.JButton();

jButton4 = new javax.swing.JButton();

txtName = new javax.swing.JTextField();

jLabel1 = new javax.swing.JLabel();

jLabel2 = new javax.swing.JLabel();

jScrollPane1 = new javax.swing.JScrollPane();

txtTooltips = new javax.swing.JTextArea();

cbDrugType = new javax.swing.JComboBox();

jLabel3 = new javax.swing.JLabel();

jLabel4 = new javax.swing.JLabel();

jLabel5 = new javax.swing.JLabel();

jScrollPane2 = new javax.swing.JScrollPane();

txtSave = new javax.swing.JTextArea();

jLabel6 = new javax.swing.JLabel();

jScrollPane3 = new javax.swing.JScrollPane();

txtEffects = new javax.swing.JTextArea();

jScrollPane4 = new javax.swing.JScrollPane();

txtForm = new javax.swing.JTextArea();

setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

setResizable(false);

jButton3.setText("Вихід");

jButton3.addActionListener(new java.awt.ev

ent.ActionListener() {

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

jButton3ActionPerformed(evt);

}

});

jButton4.setText("Створити");

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

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

jButton4ActionPerformed(evt);

}

});

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

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

txtNameActionPerformed(evt);

}

});

jLabel1.setText("Назва препарату");

jLabel2.setText("Опис препарату:");

txtTooltips.setColumns(20);

txtTooltips.setRows(5);

jScrollPane1.setViewportView(txtTooltips);

cbDrugType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Антибіотики", "Анальгетики", "Антисептики", "Імуностимулятори", "Лікарські рослини", "Наркотики", " " }));

jLabel3.setText("Тип препарату:");

jLabel4.setText("Склад і форма випуску ліки:");

jLabel5.setText("Побічні явища:");

txtSave.setColumns(20);

Группа 929

txtSave.setRows(5);

jScrollPane2.setViewportView(txtSave);

jLabel6.setText("Умови зберігання лікарських засобів:");

txtEffects.setColumns(20);

txtEffects.setRows(5);

jScrollPane3.setViewportView(txtEffects);

txtForm.setColumns(20);

txtForm.setRows(5);

jScrollPane4.setViewportView(txtForm);

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)

.addGroup(layout.createSequentialGroup()

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

.addComponent(jLabel1)

.addComponent(jLabel3))

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

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

.addComponent(cbDrugType, 0, 481, Short.MAX_VALUE)

.addComponent(txtName)))

.addComponent(jScrollPane4,

javax.swing.GroupLayout.Alignment.TRAILING)

.addComponent(jScrollPane2)

.addComponent(jScrollPane1)

.addComponent(jScrollPane3,

javax.swing.GroupLayout.Alignment.TRAILING)

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

.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(layout.createSequentialGroup()

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

.addComponent(jLabel4)

.addComponent(jLabel6)

.addComponent(jLabel2)

.addComponent(jLabel5))

.addGap(0, 0, Short.MAX_VALUE)))

.addContainerGap())

);

layout.setVerticalGroup(

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

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

.addGap(10, 10, 10)

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

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

.addComponent(jLabel1))

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

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

.addComponent(jLabel3)

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

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

.addComponent(jLabel4)

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

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

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) Группа 949

.addComponent(jLabel5)

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

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

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

.addComponent(jLabel6)

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

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

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

.addComponent(jLabel2)

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

.addComponent(jScrollPane1, 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.BASELINE)

.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))

.addContainerGap())

);

pack();

}// </editor-fold>

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

this.dispose();

}

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

String sql = "INSERT INTO " + JMain.sTable + " (drugname,druginfo,drugtype,form,effects,save)VALUES (?,?,?,?,?,?)";

try {

PreparedStatement pst = JMain.con.prepareStatement(sql);

pst.setString(1, txtName.getText());

pst.setString(2, txtTooltips.getText());

pst.setString(3, cbDrugType.getSelectedItem().toString());

pst.setString(4, txtForm.getText());

pst.setString(5, txtEffects.getText());

pst.setString(6, txtSave.getText());

int n = pst.executeUpdate();

} catch(SQLException ex) {

JOptionPane.showMessageDialog(null, "Помилка: " + ex);

Logger.getLogger(jAdd.class.getName()).log(Level.SEVERE, null, ex);

}

this.dispose();

}

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

// TODO add your handling code here:

}

/**

* @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(jAdd.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (InstantiationException ex) {

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

} catch (IllegalAccessException ex) {

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

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(jAdd.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 jAdd().setVisible(true);

}Группа 969

});

}

// Variables declaration - do not modify

private javax.swing.JComboBox cbDrugType;

private javax.swing.JButton jButton3;

private javax.swing.JButton jButton4;

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel3;

private javax.swing.JLabel jLabel4;

private javax.swing.JLabel jLabel5;

private javax.swing.JLabel jLabel6;

private javax.swing.JScrollPane jScrollPane1;

private javax.swing.JScrollPane jScrollPane2;

private javax.swing.JScrollPane jScrollPane3;

private javax.swing.JScrollPane jScrollPane4;

private javax.swing.JTextArea txtEffects;

private javax.swing.JTextArea txtForm;

private javax.swing.JTextField txtName;

private javax.swing.JTextArea txtSave;

private javax.swing.JTextArea txtTooltips;

// End of variables declaration

}

import java.awt.Color;

import java.awt.Dimension;

import java.awt.Toolkit;

import java.io.BufferedWriter;

import java.io.FileOutputStream;

import java.io.IOException;

import java.io.OutputStreamWriter;

import java.io.UnsupportedEncodingException;

import java.io.Writer;

import java.nio.file.Path;

import java.nio.file.Paths;

import java.sql.PreparedStatement;

import java.sql.SQLException;

import java.util.logging.Level;

import java.util.logging.Logger;

import javax.swing.JOptionPane;

public class jDrugInfo extends javax.swing.JFrame {

public static String strInfo = "";

public static String strName = "";

public static String strType = "";

public static String strForm = "";

public static String strEffects = "";

public static String strSave = "";

public static int iId = 0;

public jDrugInfo() {

initComponents();

Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();

this.setLocation(dim.width/2-this.getSize().width/2, dim.height/2-this.getSize().height/2);

this.getContentPane().setBackground(new Color(205,175,192));

this.setTitle("Інформація про препарат");

txtDrugInfo.setText(strInfo);

txtName.setText(strName);

cbDrugType.setSelectedItem(strType);

txtForm.setText(strForm);

txtEffects.setText(strEffects);

txtSave.setText(strSave);

}

@SuppressWarnings("unchecked")

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

private void initComponents() {

btExit = new javax.swing.JButton();

jButton7 = new javax.swing.JButton();

jLabel4 = new javax.swing.JLabel();

jButton4 = new javax.swing.JButton();

jLabel5 = new javax.swing.JLabel();

txtName = new javax.swing.JTextField();

jScrollPane2 = new javax.swing.JScrollPane();

txtSave = new javax.swing.JTextArea();

jLabel1 = new javax.swing.JLabel();

jLabel2 = new javax.swing.JLabel();

jLabel6 = new javax.swing.JLabel();

jScrollPane1 = new javax.swing.JScrollPane();

txtDrugInfo = new javax.swing.JTextArea();

jScrollPane3 = new javax.swing.JScrollPane();

txtEffects = new javax.swing.JTextArea();

cbDrugType = new javax.swing.JComboBox();

jScrollPane4 = new javax.swing.JScrollPane();

txtForm = new javax.swing.JTextArea();

jLabel3 = new javax.swing.JLabel();

jLabel7 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

setResizable(false);

btExit.setText("Вихід");

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

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

btExitActionPerformed(evt);

}

});

jButton7.setText("Замінити");

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

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

jButton7ActionPerformed(evt);

}

});

jButton4.setText("Поставити на друк");

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

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

jButton4ActionPerformed(evt);

}

});

jLabel5.setText("Побічні явища:");

txtSave.setColumns(20);

txtSave.setRows(5);

Группа 989

jScrollPane2.setViewportView(txtSave);

jLabel1.setText("Назва препарату");

jLabel2.setText("Опис препарату:");

jLabel6.setText("Умови зберігання лікарських засобів:");

txtDrugInfo.setColumns(20);

txtDrugInfo.setRows(5);

jScrollPane1.setViewportView(txtDrugInfo);

txtEffects.setColumns(20);

txtEffects.setRows(5);

jScrollPane3.setViewportView(txtEffects);

cbDrugType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Антибіотики", "Анальгетики", "Антисептики", "Імуностимулятори", "Лікарські рослини", "Наркотики", " " }));

txtForm.setColumns(20);

txtForm.setRows(5);

jScrollPane4.setViewportView(txtForm);

jLabel3.setText("Тип препарату:");

jLabel7.setText("Склад і форма випуску ліки:");

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)

.addGroup(layout.createSequentialGroup()

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

.addComponent(jLabel1)

.addComponent(jLabel3))

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

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

.addComponent(cbDrugType, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(txtName)))

.addComponent(jScrollPane4, javax.swing.GroupLayout.Alignment.TRAILING)

.addComponent(jScrollPane2)

.addComponent(jScrollPane1)

.addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.TRAILING)

.addGroup(layout.createSequentialGroup()

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

.addGroup(layout.createSequentialGroup()

.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(127, 127, 127)

.addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(6, 6, 6)

.addComponent(btExit, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE))

.addComponent(jLabel7)

.addComponent(jLabel6)

.addComponent(jLabel2)

.addComponent(jLabel5))

.addGap(0, 0, Short.MAX_VALUE)))

.addContainerGap())

);

layout.setVerticalGroup(

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

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

.addContainerGap()

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

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

.addComponent(jLabel1))

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

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

.addComponent(jLabel3)

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

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

.addComponent(jLabel7)

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

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

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

.addComponent(jLabel5)

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

Группа 1009

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

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

.addComponent(jLabel6)

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

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

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

.addComponent(jLabel2)

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

.addComponent(jScrollPane1, 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, false)

.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE))

.addContainerGap())

);

pack();

}// </editor-fold>

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

this.dispose();

}

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

String sql = "UPDATE " + JMain.sTable + " SET drugname = ?, druginfo = ?, drugtype = ?, form = ?, effects = ?, save = ? WHERE id = " + iId;

try {

PreparedStatement pst = JMain.con.prepareStatement(sql);

pst.setString(1, txtName.getText());

pst.setString(2, txtDrugInfo.getText());

pst.setString(3, cbDrugType.getSelectedItem().toString());

pst.setString(4, txtForm.getText());

pst.setString(5, txtEffects.getText());

pst.setString(6, txtSave.getText());

pst.executeUpdate();

} catch(SQLException ex) {

JOptionPane.showMessageDialog(null, "Помилка: " + ex);

Logger.getLogger(jAdd.class.getName()).log(Level.SEVERE, null, ex);

}

this.dispose();

}

private String GetCurDir()

{

Path currentRelativePath = Paths.get("");

return currentRelativePath.toAbsolutePath().toString();

}

public void saveFile(String aString, String outfilename) throws UnsupportedEncodingException, IOException

{

try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outfilename), "CP1251"))) {

out.write(aString);

}

}

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

String GenFile = jLabel1.getText() + " " + txtName.getText() + "\r\n"

+ jLabel3.getText() + " " + cbDrugType.getSelectedItem().toString() + "\r\n"

+ jLabel7.getText() + " " + txtForm.getText() + "\r\n"

+ jLabel5.getText() + " " + txtEffects.getText() + "\r\n"

+ jLabel6.getText() + " " + txtSave.getText() + "\r\n"

+ jLabel2.getText() + " " + txtDrugInfo.getText();

try {

saveFile(GenFile, GetCurDir()+"\\s.txt");

Runtime runt = Runtime.getRuntime();

Process proc = runt.exec("notepad.exe " + GetCurDir()+"\\s.txt");

} catch (IOException ex) {

Logger.getLogger(jDrugInfo.class.getName()).log(Level.SEVERE, null, ex);

}

}

/**

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

Группа 1029

* 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(jDrugInfo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (InstantiationException ex) {

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

} catch (IllegalAccessException ex) {

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

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(jDrugInfo.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 jDrugInfo().setVisible(true);

}

});

}

// Variables declaration - do not modify

private javax.swing.JButton btExit;

private javax.swing.JComboBox cbDrugType;

private javax.swing.JButton jButton4;

private javax.swing.JButton jButton7;

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel3;

private javax.swing.JLabel jLabel4;

private javax.swing.JLabel jLabel5;

private javax.swing.JLabel jLabel6;

private javax.swing.JLabel jLabel7;

private javax.swing.JScrollPane jScrollPane1;

private javax.swing.JScrollPane jScrollPane2;

private javax.swing.JScrollPane jScrollPane3;

private javax.swing.JScrollPane jScrollPane4;

private javax.swing.JTextArea txtDrugInfo;

private javax.swing.JTextArea txtEffects;

private javax.swing.JTextArea txtForm;

private javax.swing.JTextField txtName;

private javax.swing.JTextArea txtSave;

// End of variables declaration

}

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]