diff --git a/src/puntocassa/FrmCerca.form b/src/puntocassa/FrmCercaNew.form
similarity index 74%
rename from src/puntocassa/FrmCerca.form
rename to src/puntocassa/FrmCercaNew.form
index 86492e5..7c750d4 100644
--- a/src/puntocassa/FrmCerca.form
+++ b/src/puntocassa/FrmCercaNew.form
@@ -31,7 +31,7 @@
-
+
@@ -51,6 +51,9 @@
+
+
+
@@ -59,32 +62,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -93,6 +70,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -104,16 +114,16 @@
+
-
-
-
-
-
-
-
+
+
+
-
+
+
+
+
@@ -122,7 +132,7 @@
-
+
@@ -237,6 +247,9 @@
+
+
+
@@ -263,6 +276,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/puntocassa/FrmCerca.java b/src/puntocassa/FrmCercaNew.java
similarity index 82%
rename from src/puntocassa/FrmCerca.java
rename to src/puntocassa/FrmCercaNew.java
index 587fb20..bc9e65d 100644
--- a/src/puntocassa/FrmCerca.java
+++ b/src/puntocassa/FrmCercaNew.java
@@ -30,7 +30,7 @@ import puntocassa.utils.Utils;
*
* @author Marco
*/
-public class FrmCerca extends javax.swing.JFrame {
+public class FrmCercaNew extends javax.swing.JFrame {
private PuntoCassa frmPuntoCassa;
private JTextField jtxtTessera;
@@ -46,7 +46,7 @@ private JTextField jtxtTessera;
/**
* Creates new form frm
*/
- public FrmCerca(PuntoCassa frm,JTextField jtxtT,String imgPath,String BuoniPasto,Boolean flagMostraDataNascita) {
+ public FrmCercaNew(PuntoCassa frm,JTextField jtxtT,String imgPath,String BuoniPasto,Boolean flagMostraDataNascita) {
BP=BuoniPasto;
frmPuntoCassa=frm;
frmPuntoCassa.setEnabled(false);
@@ -128,6 +128,8 @@ private JTextField jtxtTessera;
jBtnOK = new javax.swing.JButton();
jbtnSu = new javax.swing.JButton();
jbtnGiu = new javax.swing.JButton();
+ jtxtNumMatricola = new javax.swing.JTextField();
+ lblNumMatricola = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Cerca Tessera Attiva");
@@ -237,6 +239,22 @@ private JTextField jtxtTessera;
}
});
+ jtxtNumMatricola.setMinimumSize(new java.awt.Dimension(64, 28));
+ jtxtNumMatricola.setPreferredSize(new java.awt.Dimension(64, 28));
+ jtxtNumMatricola.addFocusListener(new java.awt.event.FocusAdapter() {
+ public void focusGained(java.awt.event.FocusEvent evt) {
+ jtxtNumMatricolaFocusGained(evt);
+ }
+ });
+ jtxtNumMatricola.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ jtxtNumMatricolaMouseClicked(evt);
+ }
+ });
+
+ lblNumMatricola.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
+ lblNumMatricola.setText("Matricola:");
+
javax.swing.GroupLayout pnl1Layout = new javax.swing.GroupLayout(pnl1);
pnl1.setLayout(pnl1Layout);
pnl1Layout.setHorizontalGroup(
@@ -244,32 +262,37 @@ private JTextField jtxtTessera;
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnl1Layout.createSequentialGroup()
.addComponent(jLblTitolo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(256, 256, 256))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnl1Layout.createSequentialGroup()
- .addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jtxtCognome, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(lblCognome))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(lblNome)
- .addComponent(jtxtNome, javax.swing.GroupLayout.PREFERRED_SIZE, 181, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(pnl1Layout.createSequentialGroup()
- .addComponent(lblCF)
- .addContainerGap())
- .addGroup(pnl1Layout.createSequentialGroup()
- .addComponent(jtxtNumTessera, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(jBtnCerca, javax.swing.GroupLayout.DEFAULT_SIZE, 128, Short.MAX_VALUE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jbtnAnnulla, javax.swing.GroupLayout.DEFAULT_SIZE, 135, Short.MAX_VALUE))))
- .addComponent(jBtnOK, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(pnl1Layout.createSequentialGroup()
.addComponent(jScrollPane3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jbtnSu, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jbtnGiu, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addGroup(pnl1Layout.createSequentialGroup()
+ .addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(pnl1Layout.createSequentialGroup()
+ .addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(lblCognome)
+ .addComponent(jtxtCognome, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jtxtNome, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(lblNome))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(lblNumMatricola)
+ .addComponent(jtxtNumMatricola, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(pnl1Layout.createSequentialGroup()
+ .addComponent(jtxtNumTessera, javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jBtnCerca, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jbtnAnnulla, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addComponent(lblCF)))
+ .addComponent(jBtnOK, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(0, 0, Short.MAX_VALUE))
);
pnl1Layout.setVerticalGroup(
pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -279,15 +302,16 @@ private JTextField jtxtTessera;
.addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblCognome)
.addComponent(lblNome)
- .addComponent(lblCF))
+ .addComponent(lblCF)
+ .addComponent(lblNumMatricola))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
- .addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jtxtNumTessera, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jBtnCerca, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jbtnAnnulla, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jtxtCognome, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 42, Short.MAX_VALUE)
.addComponent(jtxtNome, javax.swing.GroupLayout.Alignment.TRAILING)
- .addComponent(jtxtCognome, javax.swing.GroupLayout.Alignment.TRAILING))
+ .addComponent(jtxtNumMatricola, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(jtxtNumTessera)
+ .addComponent(jBtnCerca, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(jbtnAnnulla, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
@@ -295,11 +319,13 @@ private JTextField jtxtTessera;
.addComponent(jbtnSu, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jbtnGiu, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(0, 50, Short.MAX_VALUE)))
+ .addGap(0, 53, Short.MAX_VALUE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jBtnOK, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE))
);
+ jtxtNumTessera.getAccessibleContext().setAccessibleName("");
+
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
@@ -308,7 +334,7 @@ private JTextField jtxtTessera;
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(6, 6, 6)
- .addComponent(pnl1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(pnl1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap()))
);
layout.setVerticalGroup(
@@ -320,6 +346,8 @@ private JTextField jtxtTessera;
.addContainerGap()))
);
+ pnl1.getAccessibleContext().setAccessibleName("");
+
pack();
}// //GEN-END:initComponents
@@ -329,16 +357,8 @@ private JTextField jtxtTessera;
jtxtNumTessera.setBackground(Color.yellow);
jtxtNome.setBackground(Color.white);
jtxtCognome.setBackground(Color.white);
+ jtxtNumMatricola.setBackground(Color.white);
}
-// MyApplication MyA = new MyApplication();
-// if (MyA.TastieraVideo) {
-// if (MyA.UltimoTxt.equalsIgnoreCase(evt.getComponent().toString())) {
-// MyA.UltimoTxt = " ";
-// } else {
-// MyA.UltimoTxt = evt.getComponent().toString();
-// Tastiera((JTextField) evt.getComponent(), 0, 0);
-// }
-// }
}//GEN-LAST:event_jtxtNumTesseraFocusGained
private void jbtnAnnullaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnAnnullaActionPerformed
@@ -376,15 +396,7 @@ private JTextField jtxtTessera;
jtxtNome.setBackground(Color.yellow);
jtxtNumTessera.setBackground(Color.white);
jtxtCognome.setBackground(Color.white);
-// MyApplication MyA = new MyApplication();
-// if (MyA.TastieraVideo) {
-// if (MyA.UltimoTxt.equalsIgnoreCase(evt.getComponent().toString())) {
-// MyA.UltimoTxt = " ";
-// } else {
-// MyA.UltimoTxt = evt.getComponent().toString();
-// Tastiera((JTextField) evt.getComponent(), 0, 0);
-// }
-// }
+ jtxtNumMatricola.setBackground(Color.white);
}//GEN-LAST:event_jtxtNomeFocusGained
private void jtxtCognomeFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jtxtCognomeFocusGained
@@ -392,26 +404,19 @@ private JTextField jtxtTessera;
Tastiera(evt);
}
jtxtCognome.setBackground(Color.yellow);
-
+ jtxtNumMatricola.setBackground(Color.white);
jtxtNumTessera.setBackground(Color.white);
jtxtNome.setBackground(Color.white);
-// MyApplication MyA = new MyApplication();
-// if (MyA.TastieraVideo) {
-// System.out.print("jtxtCognomeFocusGained:" + evt.getComponent().toString());
-// if (MyA.UltimoTxt.equalsIgnoreCase(evt.getComponent().toString())) {
-// MyA.UltimoTxt = " ";
-// } else {
-// MyA.UltimoTxt = evt.getComponent().toString();
-// Tastiera((JTextField) evt.getComponent(), 0, 0);
-// }
-// }
}//GEN-LAST:event_jtxtCognomeFocusGained
private void jBtnCercaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnCercaActionPerformed
Cerca();
}//GEN-LAST:event_jBtnCercaActionPerformed
public void Cerca() {
- if (jtxtCognome.getText().trim().length() <= 0 && jtxtNome.getText().trim().length() <= 0 && jtxtNumTessera.getText().trim().length() <= 0) {
+ if (jtxtCognome.getText().trim().length() <= 0 &&
+ jtxtNome.getText().trim().length() <= 0 &&
+ jtxtNumMatricola.getText().trim().length() <= 0 &&
+ jtxtNumTessera.getText().trim().length() <= 0) {
JOptionPane.showMessageDialog(this, "Inserire Cognome o Nome o Numero Tessera!", "Attenzione", JOptionPane.INFORMATION_MESSAGE);
return;
}
@@ -479,6 +484,18 @@ private JTextField jtxtTessera;
private void jtxtNumTesseraMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jtxtNumTesseraMouseClicked
Tastiera(evt);
}//GEN-LAST:event_jtxtNumTesseraMouseClicked
+
+ private void jtxtNumMatricolaFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jtxtNumMatricolaFocusGained
+ Tastiera(evt);
+ jtxtNumMatricola.setBackground(Color.yellow);
+ jtxtNumTessera.setBackground(Color.white);
+ jtxtCognome.setBackground(Color.white);
+ jtxtNome.setBackground(Color.white);
+ }//GEN-LAST:event_jtxtNumMatricolaFocusGained
+
+ private void jtxtNumMatricolaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jtxtNumMatricolaMouseClicked
+ Tastiera(evt);
+ }//GEN-LAST:event_jtxtNumMatricolaMouseClicked
private void Tastiera(java.awt.event.MouseEvent evt) {
MyApplication MyA = new MyApplication();
if (MyA.tastieraVideo) {
@@ -559,6 +576,7 @@ private JTextField jtxtTessera;
String Where= "";// " and UPPER(Cognome) like '" + jtxtCognome.getText().trim().toUpperCase().replace("'", "''") + "%' ";
if (jtxtCognome.getText().trim().length()>0){Where=Where + " and UPPER(Utenti.Cognome) like '" + jtxtCognome.getText().trim().toUpperCase().replace("'", "''") + "%' ";}
if (jtxtNome.getText().trim().length()>0) {Where=Where + " and UPPER(Utenti.Nome) like '" + jtxtNome.getText().trim().toUpperCase().replace("'", "''") + "%'"; }
+ if (jtxtNumMatricola.getText().trim().length()>0) {Where=Where + " and UPPER(Utenti.Matricola) like '" + jtxtNumMatricola.getText().trim().toUpperCase().replace("'", "''") + "%'"; }
if (jtxtNumTessera.getText().trim().length()>0) {Where=Where + " and UPPER(Tessere.Numero) like '" + jtxtNumTessera.getText().trim().toUpperCase().replace("'", "''") + "%'"; }
String[] Col = {"id","Cognome","Nome","Data di Nascita","Tessera","Data Scadenza", "Fascia"};
String[] ColType = {"long", "text","text","data","text","data","text"};
@@ -708,23 +726,51 @@ private JTextField jtxtTessera;
}
}
} catch (ClassNotFoundException ex) {
- java.util.logging.Logger.getLogger(FrmCerca.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ java.util.logging.Logger.getLogger(FrmCercaNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
- java.util.logging.Logger.getLogger(FrmCerca.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ java.util.logging.Logger.getLogger(FrmCercaNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
- java.util.logging.Logger.getLogger(FrmCerca.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ java.util.logging.Logger.getLogger(FrmCercaNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
- java.util.logging.Logger.getLogger(FrmCerca.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ java.util.logging.Logger.getLogger(FrmCercaNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//
//
//
//
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
- new FrmCerca(null,null,null,null,true).setVisible(true);
+ new FrmCercaNew(null,null,null,null,true).setVisible(true);
}
});
}
@@ -740,10 +786,12 @@ private JTextField jtxtTessera;
private javax.swing.JButton jbtnSu;
private javax.swing.JTextField jtxtCognome;
private javax.swing.JTextField jtxtNome;
+ private javax.swing.JTextField jtxtNumMatricola;
private javax.swing.JTextField jtxtNumTessera;
private javax.swing.JLabel lblCF;
private javax.swing.JLabel lblCognome;
private javax.swing.JLabel lblNome;
+ private javax.swing.JLabel lblNumMatricola;
private javax.swing.JPanel pnl1;
// End of variables declaration//GEN-END:variables
diff --git a/src/puntocassa/MyKeyBoard.java b/src/puntocassa/MyKeyBoard.java
index 28d952b..7030719 100644
--- a/src/puntocassa/MyKeyBoard.java
+++ b/src/puntocassa/MyKeyBoard.java
@@ -189,8 +189,8 @@ public class MyKeyBoard extends javax.swing.JFrame {
private void jBtnInvioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnInvioActionPerformed
if (formCerca) {
- FrmCerca frm;
- frm = (FrmCerca) parent;
+ FrmCercaNew frm;
+ frm = (FrmCercaNew) parent;
frm.Cerca();
}
diff --git a/src/puntocassa/PuntoCassa.java b/src/puntocassa/PuntoCassa.java
index e12fca7..5ac2800 100644
--- a/src/puntocassa/PuntoCassa.java
+++ b/src/puntocassa/PuntoCassa.java
@@ -3086,7 +3086,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
}//GEN-LAST:event_jTxtTesseraFocusGained
private void btnImpostaClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnImpostaClienteActionPerformed
- FrmCerca jFrameCerca = new FrmCerca(this, jTxtTessera, imgPath, "", flagMostraDataDiNascita);
+ FrmCercaNew jFrameCerca = new FrmCercaNew(this, jTxtTessera, imgPath, "", flagMostraDataDiNascita);
this.setEnabled(false);
Integer w = calcolaLarghezzaAltezza(650, largControlli);
@@ -3170,7 +3170,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
private void jBtnBuoniActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnBuoniActionPerformed
- FrmCerca jFrameCerca = new FrmCerca(this, jTxtTessera, imgPath, "BP", flagMostraDataDiNascita);
+ FrmCercaNew jFrameCerca = new FrmCercaNew(this, jTxtTessera, imgPath, "BP", flagMostraDataDiNascita);
this.setEnabled(false);
Integer w = calcolaLarghezzaAltezza(650, largControlli);
Integer h = calcolaLarghezzaAltezza(250, altControlli);
diff --git a/src/puntocassa/frmCerca.form b/src/puntocassa/frmCerca.form
deleted file mode 100644
index 86492e5..0000000
--- a/src/puntocassa/frmCerca.form
+++ /dev/null
@@ -1,269 +0,0 @@
-
-
-
diff --git a/src/puntocassa/frmCerca.java b/src/puntocassa/frmCerca.java
deleted file mode 100644
index 587fb20..0000000
--- a/src/puntocassa/frmCerca.java
+++ /dev/null
@@ -1,775 +0,0 @@
-/*
- * 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.
- */
-
-package puntocassa;
-
-import java.awt.Color;
-import java.awt.Font;
-import java.awt.Image;
-import java.awt.Rectangle;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.io.File;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import javax.swing.ImageIcon;
-import javax.swing.JOptionPane;
-import javax.swing.JTable;
-import javax.swing.JTextField;
-import javax.swing.ListSelectionModel;
-import javax.swing.table.TableColumn;
-import puntocassa.utils.Utils;
-
-/**
- *
- * @author Marco
- */
-public class FrmCerca extends javax.swing.JFrame {
-
-private PuntoCassa frmPuntoCassa;
-private JTextField jtxtTessera;
-
- public int HFont=15;
- private int AltControlli=100;
- private int LargControlli=100;
- private int AltRigaGriglia=0;
- private String BP="";
- private Boolean FlagMostraDataNascita=true;
- private Boolean DisabilitaPerBuono=false;
-
- /**
- * Creates new form frm
- */
- public FrmCerca(PuntoCassa frm,JTextField jtxtT,String imgPath,String BuoniPasto,Boolean flagMostraDataNascita) {
- BP=BuoniPasto;
- frmPuntoCassa=frm;
- frmPuntoCassa.setEnabled(false);
- frmPuntoCassa.addRemoveKeyDispatcher(false);
- //KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(frmPuntoCassa.keyDispatcher);
-// FlagMostraDataNascita=flagMostraDataNascita;
- jtxtTessera=jtxtT;
- initComponents();
- String startDir = System.getProperty("user.dir");
- File IconaApp = new File(startDir + "/risorse/logo.png");
- if (IconaApp.exists()) {
-
- ImageIcon icon = new ImageIcon(startDir + "/risorse/logo.png");
- this.setIconImage(icon.getImage());
- }
-
- ImageIcon icon = new ImageIcon(imgPath +"freccia_down.jpg");
- Image img = icon.getImage() ;
- Image newimg = img.getScaledInstance(50,50,java.awt.Image.SCALE_SMOOTH ) ;
- icon = new ImageIcon(newimg);
- jbtnGiu.setIcon(icon);
-
- ImageIcon icon2 = new ImageIcon(imgPath +"freccia_up.jpg");
- Image img2 = icon2.getImage() ;
- Image newimg2 = img2.getScaledInstance(50,50,java.awt.Image.SCALE_SMOOTH ) ;
- icon2 = new ImageIcon(newimg2);
- jbtnSu.setIcon(icon2);
-
- // --------------------------------------------------------------------
- // ** creo evento click jTblStudenti
- // --------------------------------------------------------------------
- jTblStudenti.addMouseListener(new MouseAdapter() {
- public void mouseClicked(MouseEvent e) {
-
- if (e.getClickCount() == 1) {
- //JTable target = (JTable) e.getSource();
- //int row = target.getSelectedRow();
- //int column = target.getSelectedColumn();
- jBtnOKActionPerformed(null);
- }
- }
- });
-
- if (BuoniPasto.length()<=0){
- CercaValoriDefault();
- }else{
- //jtxtCognome.requestFocus();
- //jtxtCognome.setBackground(Color.yellow);
- DisabilitaPerBuono=true;
-
- jtxtCognome.setText(BuoniPasto);
- Cerca();
- Disabilita();
- }
-
- }
-
- /**
- * 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")
- // //GEN-BEGIN:initComponents
- private void initComponents() {
-
- pnl1 = new javax.swing.JPanel();
- lblCF = new javax.swing.JLabel();
- lblNome = new javax.swing.JLabel();
- lblCognome = new javax.swing.JLabel();
- jBtnCerca = new javax.swing.JButton();
- jScrollPane3 = new javax.swing.JScrollPane();
- jTblStudenti = new javax.swing.JTable();
- jtxtCognome = new javax.swing.JTextField();
- jtxtNome = new javax.swing.JTextField();
- jbtnAnnulla = new javax.swing.JButton();
- jLblTitolo = new javax.swing.JLabel();
- jtxtNumTessera = new javax.swing.JTextField();
- jBtnOK = new javax.swing.JButton();
- jbtnSu = new javax.swing.JButton();
- jbtnGiu = new javax.swing.JButton();
-
- setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
- setTitle("Cerca Tessera Attiva");
- addWindowListener(new java.awt.event.WindowAdapter() {
- public void windowClosed(java.awt.event.WindowEvent evt) {
- formWindowClosed(evt);
- }
- });
-
- lblCF.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
- lblCF.setText("Num. Tessera:");
-
- lblNome.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
- lblNome.setText("Nome:");
-
- lblCognome.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
- lblCognome.setText("Cognome:");
-
- jBtnCerca.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
- jBtnCerca.setText("Cerca");
- jBtnCerca.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jBtnCercaActionPerformed(evt);
- }
- });
-
- jTblStudenti.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
- jTblStudenti.setModel(new javax.swing.table.DefaultTableModel(
- new Object [][] {
- {},
- {},
- {},
- {}
- },
- new String [] {
-
- }
- ));
- jScrollPane3.setViewportView(jTblStudenti);
-
- jtxtCognome.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
- jtxtCognome.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusGained(java.awt.event.FocusEvent evt) {
- jtxtCognomeFocusGained(evt);
- }
- });
- jtxtCognome.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseClicked(java.awt.event.MouseEvent evt) {
- jtxtCognomeMouseClicked(evt);
- }
- });
-
- jtxtNome.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
- jtxtNome.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusGained(java.awt.event.FocusEvent evt) {
- jtxtNomeFocusGained(evt);
- }
- });
- jtxtNome.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseClicked(java.awt.event.MouseEvent evt) {
- jtxtNomeMouseClicked(evt);
- }
- });
-
- jbtnAnnulla.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
- jbtnAnnulla.setText("Annulla");
- jbtnAnnulla.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jbtnAnnullaActionPerformed(evt);
- }
- });
-
- jLblTitolo.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
- jLblTitolo.setForeground(new java.awt.Color(255, 0, 0));
- jLblTitolo.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
- jLblTitolo.setText("Cerca Tessera Attiva");
-
- jtxtNumTessera.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
- jtxtNumTessera.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusGained(java.awt.event.FocusEvent evt) {
- jtxtNumTesseraFocusGained(evt);
- }
- });
- jtxtNumTessera.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseClicked(java.awt.event.MouseEvent evt) {
- jtxtNumTesseraMouseClicked(evt);
- }
- });
-
- jBtnOK.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
- jBtnOK.setText("OK");
- jBtnOK.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jBtnOKActionPerformed(evt);
- }
- });
-
- jbtnSu.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jbtnSuActionPerformed(evt);
- }
- });
-
- jbtnGiu.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jbtnGiuActionPerformed(evt);
- }
- });
-
- javax.swing.GroupLayout pnl1Layout = new javax.swing.GroupLayout(pnl1);
- pnl1.setLayout(pnl1Layout);
- pnl1Layout.setHorizontalGroup(
- pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnl1Layout.createSequentialGroup()
- .addComponent(jLblTitolo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGap(256, 256, 256))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnl1Layout.createSequentialGroup()
- .addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jtxtCognome, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(lblCognome))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(lblNome)
- .addComponent(jtxtNome, javax.swing.GroupLayout.PREFERRED_SIZE, 181, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(pnl1Layout.createSequentialGroup()
- .addComponent(lblCF)
- .addContainerGap())
- .addGroup(pnl1Layout.createSequentialGroup()
- .addComponent(jtxtNumTessera, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(jBtnCerca, javax.swing.GroupLayout.DEFAULT_SIZE, 128, Short.MAX_VALUE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jbtnAnnulla, javax.swing.GroupLayout.DEFAULT_SIZE, 135, Short.MAX_VALUE))))
- .addComponent(jBtnOK, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGroup(pnl1Layout.createSequentialGroup()
- .addComponent(jScrollPane3)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jbtnSu, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jbtnGiu, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)))
- );
- pnl1Layout.setVerticalGroup(
- pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnl1Layout.createSequentialGroup()
- .addComponent(jLblTitolo, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(lblCognome)
- .addComponent(lblNome)
- .addComponent(lblCF))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
- .addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jtxtNumTessera, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jBtnCerca, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jbtnAnnulla, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addComponent(jtxtNome, javax.swing.GroupLayout.Alignment.TRAILING)
- .addComponent(jtxtCognome, javax.swing.GroupLayout.Alignment.TRAILING))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
- .addGroup(pnl1Layout.createSequentialGroup()
- .addComponent(jbtnSu, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jbtnGiu, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(0, 50, Short.MAX_VALUE)))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jBtnOK, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE))
- );
-
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 845, Short.MAX_VALUE)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addGap(6, 6, 6)
- .addComponent(pnl1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addContainerGap()))
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 322, Short.MAX_VALUE)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addComponent(pnl1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addContainerGap()))
- );
-
- pack();
- }// //GEN-END:initComponents
-
- private void jtxtNumTesseraFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jtxtNumTesseraFocusGained
- if (DisabilitaPerBuono==false){
- Tastiera(evt);
- jtxtNumTessera.setBackground(Color.yellow);
- jtxtNome.setBackground(Color.white);
- jtxtCognome.setBackground(Color.white);
- }
-// MyApplication MyA = new MyApplication();
-// if (MyA.TastieraVideo) {
-// if (MyA.UltimoTxt.equalsIgnoreCase(evt.getComponent().toString())) {
-// MyA.UltimoTxt = " ";
-// } else {
-// MyA.UltimoTxt = evt.getComponent().toString();
-// Tastiera((JTextField) evt.getComponent(), 0, 0);
-// }
-// }
- }//GEN-LAST:event_jtxtNumTesseraFocusGained
-
- private void jbtnAnnullaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnAnnullaActionPerformed
-// ClearTable((MyTableModel)jTblStudenti.getModel());
-
- //frmPuntoCassa.setEnabled(true);
- //frmPuntoCassa=null;
- this.dispose();
-
- }//GEN-LAST:event_jbtnAnnullaActionPerformed
- private void ClearTable(MyTableModel model) {
- try {
- for (Integer i = model.getRowCount() - 1; i >= 0; i--) {
- model.deleteRow(i);
- }
- } catch (Exception e) {
- }
- }
- private void Tastiera(JTextField jTxt,Integer MyX,Integer MyY){
- if (DisabilitaPerBuono==false){
- MyKeyBoard myk=new MyKeyBoard(this,true);
- myk.txt=jTxt;
- myk.parent=this;
- Rectangle s=this.getBounds();
- Rectangle s2=jTxt.getBounds();
- Integer l=s.x+s2.x+MyX;
- if(l+800>s.x+s.width){l=s.x+s.width-800;}
- myk.setBounds(l,s.y+s2.y+60+MyY, 800, 300);
- myk.setVisible(true);
- }
-
- }
- private void jtxtNomeFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jtxtNomeFocusGained
- Tastiera(evt);
- jtxtNome.setBackground(Color.yellow);
- jtxtNumTessera.setBackground(Color.white);
- jtxtCognome.setBackground(Color.white);
-// MyApplication MyA = new MyApplication();
-// if (MyA.TastieraVideo) {
-// if (MyA.UltimoTxt.equalsIgnoreCase(evt.getComponent().toString())) {
-// MyA.UltimoTxt = " ";
-// } else {
-// MyA.UltimoTxt = evt.getComponent().toString();
-// Tastiera((JTextField) evt.getComponent(), 0, 0);
-// }
-// }
- }//GEN-LAST:event_jtxtNomeFocusGained
-
- private void jtxtCognomeFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jtxtCognomeFocusGained
- if(BP.length()<=0){
- Tastiera(evt);
- }
- jtxtCognome.setBackground(Color.yellow);
-
- jtxtNumTessera.setBackground(Color.white);
- jtxtNome.setBackground(Color.white);
-// MyApplication MyA = new MyApplication();
-// if (MyA.TastieraVideo) {
-// System.out.print("jtxtCognomeFocusGained:" + evt.getComponent().toString());
-// if (MyA.UltimoTxt.equalsIgnoreCase(evt.getComponent().toString())) {
-// MyA.UltimoTxt = " ";
-// } else {
-// MyA.UltimoTxt = evt.getComponent().toString();
-// Tastiera((JTextField) evt.getComponent(), 0, 0);
-// }
-// }
- }//GEN-LAST:event_jtxtCognomeFocusGained
-
- private void jBtnCercaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnCercaActionPerformed
- Cerca();
- }//GEN-LAST:event_jBtnCercaActionPerformed
- public void Cerca() {
- if (jtxtCognome.getText().trim().length() <= 0 && jtxtNome.getText().trim().length() <= 0 && jtxtNumTessera.getText().trim().length() <= 0) {
- JOptionPane.showMessageDialog(this, "Inserire Cognome o Nome o Numero Tessera!", "Attenzione", JOptionPane.INFORMATION_MESSAGE);
- return;
- }
-
- Aggiorna();
-
- }
- private void Disabilita(){
- jtxtCognome.setEnabled(false);
- jtxtNome.setEnabled(false);
- jtxtNumTessera.setEnabled(false);
- jBtnCerca.setEnabled(false);
- jBtnOK.requestFocus();
- }
- private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
- try{
- frmPuntoCassa.setEnabled(true);
- frmPuntoCassa.addRemoveKeyDispatcher(true);
- //KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(frmPuntoCassa.keyDispatcher);
- frmPuntoCassa.toFront();
- frmPuntoCassa.repaint();
- frmPuntoCassa=null;
- this.dispose();
- }catch(Exception ex){}
- }//GEN-LAST:event_formWindowClosed
-
- private void jBtnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnOKActionPerformed
- if (jTblStudenti.getSelectedRow() >= 0 ) {
- MyTableModel model = new MyTableModel();
- model = (MyTableModel) jTblStudenti.getModel();
- String nTessera = model.getValueAt(jTblStudenti.getSelectedRow(), 4).toString();
-
- jtxtTessera.setText(nTessera);
- this.dispose();
- frmPuntoCassa.cercaTessera();
-
- }
-
- }//GEN-LAST:event_jBtnOKActionPerformed
-
- private void jbtnSuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnSuActionPerformed
- // TODO add your handling code here:
- if(jTblStudenti.getSelectedRow()>0){
- jTblStudenti.setRowSelectionInterval(jTblStudenti.getSelectedRow()-1, jTblStudenti.getSelectedRow()-1);
- jTblStudenti.scrollRectToVisible(new Rectangle(jTblStudenti.getCellRect(jTblStudenti.getSelectedRow(), 0, true)));
- }
- }//GEN-LAST:event_jbtnSuActionPerformed
-
- private void jbtnGiuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnGiuActionPerformed
- // TODO add your handling code here:
- if(jTblStudenti.getSelectedRow()0){Where=Where + " and UPPER(Utenti.Cognome) like '" + jtxtCognome.getText().trim().toUpperCase().replace("'", "''") + "%' ";}
- if (jtxtNome.getText().trim().length()>0) {Where=Where + " and UPPER(Utenti.Nome) like '" + jtxtNome.getText().trim().toUpperCase().replace("'", "''") + "%'"; }
- if (jtxtNumTessera.getText().trim().length()>0) {Where=Where + " and UPPER(Tessere.Numero) like '" + jtxtNumTessera.getText().trim().toUpperCase().replace("'", "''") + "%'"; }
- String[] Col = {"id","Cognome","Nome","Data di Nascita","Tessera","Data Scadenza", "Fascia"};
- String[] ColType = {"long", "text","text","data","text","data","text"};
- String QueryCount="Select count(*) as righe " + From + Where;
- QueryDati("select UTENTI.id, UTENTI.Cognome, Utenti.Nome, Utenti.Data_Di_Nascita, Tessere.Numero as Tessera, Tessere.Data_Scadenza, Fasce.Nome as Fascia " + From + Where + " order by Cognome,Nome", QueryCount, Col, ColType, jTblStudenti, false);
-
- //jTblStudenti.getColumn("Drawing").setPreferredWidth(200);
-
-
-
- Font f=new Font("Tahoma",0,20);
- jTblStudenti.setFont(f);
- if(AltRigaGriglia==0){AltRigaGriglia=jTblStudenti.getRowHeight();}
-// txtUsername.setSize(CalcolaLarghezzaAltezza(txtUsername.getWidth(),LargControlli), CalcolaLarghezzaAltezza(txtUsername.getHeight(),AltControlli));
-
- jTblStudenti.setRowHeight(25);
-
- //ClearTable((MyTableModel)jTblTessere.getModel());
-
- if (jTblStudenti.getRowCount() > 0) {
- jTblStudenti.setRowSelectionInterval(0, 0);
-
- }
- ///AggiornaTessera(0);
-
-
- } catch (Exception e) {
- }
- }
- private Integer CalcolaLarghezzaAltezza(Integer LarControllo,Integer Percentuale){
- Integer D = Percentuale - 100;
- if (D == 0) {
- return LarControllo;
- } else {
- Integer N = LarControllo + ((LarControllo * D) / 100);
- return N;
- }
-
- }
- public Object[][] RowData(String Query, String[] Cols, String[] ColType, int rowCount) {
- Object[][] rows = null;
- try {
- Connection dbConnection = DriverManager.getConnection(frmPuntoCassa.dbStringa, frmPuntoCassa.dbUsername, frmPuntoCassa.dbPassword);
- Statement st = dbConnection.createStatement();
- ResultSet rs = st.executeQuery(Query);
- rows = new Object[rowCount][];
- int r = 0;
- while (rs.next()) {
- Object[] row = new Object[Cols.length];
- for (int i = 0; i < Cols.length; i++) {
- if (rs.getString(Cols[i].replace(" ", "_")) == null) {
- row[i] = "";
- } else {
- row[i] = rs.getString(Cols[i].replace(" ", "_"));
- }
- switch (ColType[i]) {
- case "text":
- if (rs.getString(Cols[i].replace(" ", "_")) == null) {
- row[i] = "";
- } else {
- row[i] = rs.getString(Cols[i].replace(" ", "_"));
- }
- break;
- case "integer":
- if (rs.getString(Cols[i].replace(" ", "_")) == null) {
- row[i] = 0;
- } else {
- row[i] = rs.getInt(Cols[i].replace(" ", "_"));
- }
- break;
- case "long":
- if (rs.getString(Cols[i].replace(" ", "_")) == null) {
- row[i] = 0;
- } else {
- row[i] = rs.getLong(Cols[i].replace(" ", "_"));
- }
- break;
- case "boolean":
- if (rs.getString(Cols[i].replace(" ", "_")) == null) {
- row[i] = false;
- } else {
- row[i] = rs.getBoolean(Cols[i].replace(" ", "_"));
- }
- break;
- case "float":
- if (rs.getString(Cols[i].replace(" ", "_")) == null) {
- row[i] = 0.00;
- } else {
- String v = rs.getString(Cols[i].replace(" ", "_"));
-
- row[i] = Float.parseFloat(v.replace(",", "."));
- }
-
- break;
-
- case "data":
- row[i] = "";
- if (rs.getString(Cols[i].replace(" ", "_")) != null) {
-// Date d = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss",Locale.ITALY).parse(rs.getString(Cols[i]));
- //SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
- String[] d= rs.getString(Cols[i].replace(" ", "_")).split("-");
- if (d.length>=3){
- row[i] = d[2].trim().substring(0, 2) + "/" + d[1] + "/" + d[0];
- }
- }
-
- break;
- }
-
- }
- rows[r] = row;
- r++;
- /*int id = rs.getInt("id");
- String name = rs.getString("name");
- int age = rs.getInt("age");
- String address = rs.getString("address");
- float salary = rs.getFloat("salary");*/
-
- }
- rs.close();
- st.close();
- dbConnection.close();
-
- } catch (SQLException | NumberFormatException e) {
- System.err.println(e.getClass().getName() + ": " + e.getMessage());
- } finally {
-
- return rows;
- }
-
- }
-
- /**
- * @param args the command line arguments
- */
- public static void main(String args[]) {
- /* Set the Nimbus look and feel */
- //
- /* 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(FrmCerca.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (InstantiationException ex) {
- java.util.logging.Logger.getLogger(FrmCerca.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (IllegalAccessException ex) {
- java.util.logging.Logger.getLogger(FrmCerca.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (javax.swing.UnsupportedLookAndFeelException ex) {
- java.util.logging.Logger.getLogger(FrmCerca.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- }
- //
- //
- //
- //
-
- /* Create and display the form */
- java.awt.EventQueue.invokeLater(new Runnable() {
- public void run() {
- new FrmCerca(null,null,null,null,true).setVisible(true);
- }
- });
- }
-
- // Variables declaration - do not modify//GEN-BEGIN:variables
- private javax.swing.JButton jBtnCerca;
- private javax.swing.JButton jBtnOK;
- private javax.swing.JLabel jLblTitolo;
- private javax.swing.JScrollPane jScrollPane3;
- private javax.swing.JTable jTblStudenti;
- private javax.swing.JButton jbtnAnnulla;
- private javax.swing.JButton jbtnGiu;
- private javax.swing.JButton jbtnSu;
- private javax.swing.JTextField jtxtCognome;
- private javax.swing.JTextField jtxtNome;
- private javax.swing.JTextField jtxtNumTessera;
- private javax.swing.JLabel lblCF;
- private javax.swing.JLabel lblCognome;
- private javax.swing.JLabel lblNome;
- private javax.swing.JPanel pnl1;
- // End of variables declaration//GEN-END:variables
-
- private void CercaValoriDefault() {
- try {
- MyApplication MyA = new MyApplication();
- String txtbox = Utils.mySelect("Select Valore from PARAMETRI where chiave='ImpostaTesseraCampo'", "Valore", frmPuntoCassa);
- String txtboxValore = Utils.mySelect("Select Valore from PARAMETRI where chiave='ImpostaTesseraStringa'", "Valore", frmPuntoCassa);
-
- if (txtbox.equalsIgnoreCase("COGNOME")) {
- jtxtCognome.requestFocus();
- jtxtCognome.setBackground(Color.yellow);
- jtxtCognome.setText(txtboxValore);
- }
- if (txtbox.equalsIgnoreCase("NOME")) {
- jtxtNome.requestFocus();
- jtxtNome.setBackground(Color.yellow);
- jtxtNome.setText(txtboxValore);
- }
- if (txtbox.equalsIgnoreCase("TESSERA")) {
- jtxtNumTessera.requestFocus();
- jtxtNumTessera.setBackground(Color.yellow);
- jtxtNumTessera.setText(txtboxValore);
- }
- } catch (Exception ex) {
- JOptionPane.showMessageDialog(this, ex.getMessage());
- }
- }
-}