rename classi form

aggiunto suffisso new
This commit is contained in:
Francesco Di Sciascio 2024-11-05 14:40:08 +01:00
parent 79814f154e
commit 8eba2a86b0
26 changed files with 69 additions and 4277 deletions

View File

@ -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")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//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();
}// </editor-fold>//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()<jTblStudenti.getRowCount()-1){
jTblStudenti.setRowSelectionInterval(jTblStudenti.getSelectedRow()+1, jTblStudenti.getSelectedRow()+1);
jTblStudenti.scrollRectToVisible(new Rectangle(jTblStudenti.getCellRect(jTblStudenti.getSelectedRow(), 0, true)));
}
}//GEN-LAST:event_jbtnGiuActionPerformed
private void jtxtNomeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jtxtNomeMouseClicked
Tastiera(evt);
}//GEN-LAST:event_jtxtNomeMouseClicked
private void jtxtCognomeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jtxtCognomeMouseClicked
Tastiera(evt);
}//GEN-LAST:event_jtxtCognomeMouseClicked
private void jtxtNumTesseraMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jtxtNumTesseraMouseClicked
Tastiera(evt);
}//GEN-LAST:event_jtxtNumTesseraMouseClicked
private void Tastiera(java.awt.event.MouseEvent evt) {
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);
}
}
}
//java.awt.event.FocusEvent
private void Tastiera(java.awt.event.FocusEvent evt) {
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);
}
}
}
private void QueryDati(String Query,String QueryCount,String[] Colonne,String[] ColType, JTable jTbl,Boolean Editable){
try{
MyApplication MyA=new MyApplication();
MyTableModel model = new MyTableModel( );
model.setColumname(Colonne);
// model.setEditable(Editable);
// int [] colBool=new int[1];
// colBool[0]=7;
// model.setColBoolean(colBool);
// int[] cols=new int[1];
// cols[0]=7;
// model.setColModificabile(cols);
int rowCount=Integer.parseInt(Utils.mySelect(QueryCount, "righe", frmPuntoCassa));
Object[][] data = RowData(Query, Colonne,ColType,rowCount);
model.setData(data);
try{jTbl.setModel(model);}catch(Exception e){}
jTbl.setAutoCreateColumnsFromModel(true);
jTbl.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
jTbl.getTableHeader().setFont(new Font("Tahoma", Font.BOLD, 16));
jTbl.setFont(new Font("Tahoma", 0, 16));
TableColumn column = jTbl.getColumn("id");
column.setMinWidth(0);
column.setMaxWidth(0);
column.setWidth(0);
column.setPreferredWidth(0);
// if (FlagMostraDataNascita==false){
// //Data di Nascita
// TableColumn column2 = jTbl.getColumn("Data di Nascita");
// column2.setMinWidth(0);
// column2.setMaxWidth(0);
// column2.setWidth(0);
// column2.setPreferredWidth(0);
// }
model.fireTableDataChanged();
doLayout();
}catch(NumberFormatException e){
System.out.println("Query: " + e.getMessage());
}
}
private void Aggiorna() {
try {
String From=" From utenti inner join tessere on utenti.id=tessere.id_utente inner join categorie_utenti on utenti.id_categoria=categorie_utenti.id inner join categorie_utenti_fasce on categorie_utenti_fasce.id_categoria_utenti=categorie_utenti.id inner join fasce on categorie_utenti_fasce.id_fascia=fasce.id where tessere.id_stato=1 and Tessere.Data_Scadenza>=trunc(sysdate) ";
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 (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 */
//<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(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);
}
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
/* 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());
}
}
}

View File

@ -30,7 +30,7 @@ import puntocassa.utils.Utils;
* *
* @author Marco * @author Marco
*/ */
public class FrmCerca extends javax.swing.JFrame { public class FrmCercaNew extends javax.swing.JFrame {
private PuntoCassa frmPuntoCassa; private PuntoCassa frmPuntoCassa;
private JTextField jtxtTessera; private JTextField jtxtTessera;
@ -46,7 +46,7 @@ private JTextField jtxtTessera;
/** /**
* Creates new form frm * 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; BP=BuoniPasto;
frmPuntoCassa=frm; frmPuntoCassa=frm;
frmPuntoCassa.setEnabled(false); frmPuntoCassa.setEnabled(false);
@ -708,23 +708,27 @@ private JTextField jtxtTessera;
} }
} }
} catch (ClassNotFoundException ex) { } 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) { } 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) { } 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) { } 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);
} }
//</editor-fold> //</editor-fold>
//</editor-fold> //</editor-fold>
//</editor-fold> //</editor-fold>
//</editor-fold> //</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
/* Create and display the form */ /* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() { java.awt.EventQueue.invokeLater(new Runnable() {
public void run() { public void run() {
new FrmCerca(null,null,null,null,true).setVisible(true); new FrmCercaNew(null,null,null,null,true).setVisible(true);
} }
}); });
} }

View File

@ -1,405 +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.Font;
import java.awt.Rectangle;
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 java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.ImageIcon;
import javax.swing.JComboBox;
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 FrmMeteo extends javax.swing.JFrame {
private PuntoCassa frmPuntoCassa;
private Long idPuntoCassa=0L;
private Boolean Inserimento=false;
public int HFont=15;
private int AltControlli=100;
private int LargControlli=100;
private int AltRigaGriglia=0;
/**
* Creates new form frm
*/
public FrmMeteo(PuntoCassa frm, Long id_Punto_Cassa,Boolean Nuovo) {
frmPuntoCassa=frm;
frmPuntoCassa.setEnabled(false);
//KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(frmPuntoCassa.keyDispatcher);
frmPuntoCassa.addRemoveKeyDispatcher(false);
idPuntoCassa=id_Punto_Cassa;
Inserimento=Nuovo;
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());
}
CaricaCombo("Select nome,id from condizioni_meteo order by nome", "nome", "id", jCmbCat);
}
/**
* 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">//GEN-BEGIN:initComponents
private void initComponents() {
pnl1 = new javax.swing.JPanel();
jBtnAggiorna = new javax.swing.JButton();
jCmbCat = new javax.swing.JComboBox();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Aggiorna condizioni Meteo");
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosed(java.awt.event.WindowEvent evt) {
formWindowClosed(evt);
}
});
jBtnAggiorna.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jBtnAggiorna.setText("Aggiorna");
jBtnAggiorna.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBtnAggiornaActionPerformed(evt);
}
});
jCmbCat.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jCmbCat.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
javax.swing.GroupLayout pnl1Layout = new javax.swing.GroupLayout(pnl1);
pnl1.setLayout(pnl1Layout);
pnl1Layout.setHorizontalGroup(
pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnl1Layout.createSequentialGroup()
.addComponent(jCmbCat, 0, 238, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jBtnAggiorna, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(6, 6, 6))
);
pnl1Layout.setVerticalGroup(
pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnl1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jCmbCat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jBtnAggiorna))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(pnl1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(pnl1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
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){
MyKeyBoard myk=new MyKeyBoard(this,false);
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 formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
try {
frmPuntoCassa.setEnabled(true);
//KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(frmPuntoCassa.keyDispatcher);
frmPuntoCassa.addRemoveKeyDispatcher(true);
frmPuntoCassa.toFront();
frmPuntoCassa.repaint();
frmPuntoCassa = null;
this.dispose();
} catch (Exception ex) {
}
}//GEN-LAST:event_formWindowClosed
private void jBtnAggiornaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnAggiornaActionPerformed
ComboItem c = new ComboItem(null, null);
c = (ComboItem) jCmbCat.getSelectedItem();
if (Inserimento) {
MyInsert("insert into meteo (id_Punto_Cassa,id_Condizioni) values (" + idPuntoCassa + "," + c.getKey() + ")");
} else {
Date Adesso=new Date();
MyInsert("Update meteo set id_Condizioni=" + c.getKey() + " where id_Punto_Cassa=" +
idPuntoCassa + " and to_date(ts_segnalazione,'dd/mm/yy')=" + AggiustaData(Adesso));
}
this.dispose();
}//GEN-LAST:event_jBtnAggiornaActionPerformed
private String AggiustaData(Date Data) {
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
String data = "to_date('" + formatter.format(Data) + "','dd/mm/yyyy')";
return data;
}
private Boolean MyInsert(String Query) {
Boolean res=false;
try {
Connection dbConnection = DriverManager.getConnection(frmPuntoCassa.dbStringa, frmPuntoCassa.dbUsername, frmPuntoCassa.dbPassword);
Statement st = dbConnection.createStatement();
ResultSet rs = st.executeQuery(Query);
rs.close();
st.close();
dbConnection.close();
res=true;
} catch (SQLException e) {
JOptionPane.showMessageDialog(this, "Errore MySelect ['" + e.getMessage() + " " + Query + "']");
}
return res;
}
private void QueryDati(String Query,String QueryCount,String[] Colonne,String[] ColType, JTable jTbl,Boolean Editable){
try{
MyApplication MyA=new MyApplication();
MyTableModel model = new MyTableModel( );
model.setColumname(Colonne);
// model.setEditable(Editable);
// int [] colBool=new int[1];
// colBool[0]=7;
// model.setColBoolean(colBool);
// int[] cols=new int[1];
// cols[0]=7;
// model.setColModificabile(cols);
int rowCount=Integer.parseInt(Utils.mySelect(QueryCount, "righe", frmPuntoCassa));
Object[][] data = RowData(Query, Colonne,ColType,rowCount);
model.setData(data);
try{jTbl.setModel(model);}catch(Exception e){}
jTbl.setAutoCreateColumnsFromModel(true);
jTbl.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
jTbl.getTableHeader().setFont(new Font("Tahoma", Font.BOLD, 16));
jTbl.setFont(new Font("Tahoma", 0, 16));
TableColumn column = jTbl.getColumn("id");
column.setMinWidth(0);
column.setMaxWidth(0);
column.setWidth(0);
column.setPreferredWidth(0);
model.fireTableDataChanged();
doLayout();
}catch(NumberFormatException e){
System.out.println("Query: " + e.getMessage());
}
}
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 "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();
} 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 */
//<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(FrmMeteo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmMeteo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmMeteo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmMeteo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new FrmMeteo(null,0L,true).setVisible(true);
}
});
}
private void CaricaCombo (String Query, String itemValue, String itemId, JComboBox cmb) {
try {
Connection dbConnection = DriverManager.getConnection(frmPuntoCassa.dbStringa, frmPuntoCassa.dbUsername, frmPuntoCassa.dbPassword);
Connection c = dbConnection;
Statement stmt = null;
cmb.removeAllItems();
stmt = c.createStatement();
ResultSet rs = stmt.executeQuery(Query);
int r = 0;
while (rs.next()) {
ComboItem row=new ComboItem(rs.getLong(itemId), rs.getString(itemValue)) ;
cmb.addItem(row);
r++;
}
rs.close();
stmt.close();
dbConnection.close();
} catch (SQLException e) {
System.err.println(e.getClass().getName() + ": " + e.getMessage());
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jBtnAggiorna;
private javax.swing.JComboBox jCmbCat;
private javax.swing.JPanel pnl1;
// End of variables declaration//GEN-END:variables
}

View File

@ -29,7 +29,7 @@ import puntocassa.utils.Utils;
* *
* @author Marco * @author Marco
*/ */
public class FrmMeteo extends javax.swing.JFrame { public class FrmMeteoNew extends javax.swing.JFrame {
private PuntoCassa frmPuntoCassa; private PuntoCassa frmPuntoCassa;
private Long idPuntoCassa=0L; private Long idPuntoCassa=0L;
@ -42,7 +42,7 @@ public class FrmMeteo extends javax.swing.JFrame {
/** /**
* Creates new form frm * Creates new form frm
*/ */
public FrmMeteo(PuntoCassa frm, Long id_Punto_Cassa,Boolean Nuovo) { public FrmMeteoNew(PuntoCassa frm, Long id_Punto_Cassa,Boolean Nuovo) {
frmPuntoCassa=frm; frmPuntoCassa=frm;
frmPuntoCassa.setEnabled(false); frmPuntoCassa.setEnabled(false);
@ -352,21 +352,23 @@ public class FrmMeteo extends javax.swing.JFrame {
} }
} }
} catch (ClassNotFoundException ex) { } catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmMeteo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(FrmMeteoNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) { } catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmMeteo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(FrmMeteoNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) { } catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmMeteo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(FrmMeteoNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) { } catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmMeteo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(FrmMeteoNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} }
//</editor-fold> //</editor-fold>
//</editor-fold> //</editor-fold>
//</editor-fold>
//</editor-fold>
/* Create and display the form */ /* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() { java.awt.EventQueue.invokeLater(new Runnable() {
public void run() { public void run() {
new FrmMeteo(null,0L,true).setVisible(true); new FrmMeteoNew(null,0L,true).setVisible(true);
} }
}); });
} }

View File

@ -1,516 +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.Font;
import java.awt.Image;
import java.awt.Rectangle;
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 FrmMovimenti extends javax.swing.JFrame {
private PuntoCassa frmPuntoCassa;
private Long idTessera=0L,idPuntoCassa=0L;
public int HFont = 15;
private int AltControlli = 100;
private int LargControlli = 100;
private int AltRigaGriglia = 0;
/**
* Creates new form frm
*/
public FrmMovimenti(PuntoCassa frm,Long IDTessera,Long IDPuntoCassa,String imgPath) {
frmPuntoCassa=frm;
frmPuntoCassa.setEnabled(false);
//KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(frmPuntoCassa.keyDispatcher);
frmPuntoCassa.addRemoveKeyDispatcher(false);
idPuntoCassa=IDPuntoCassa;
idTessera=IDTessera;
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);
Aggiorna();
}
/**
* 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">//GEN-BEGIN:initComponents
private void initComponents() {
pnl1 = new javax.swing.JPanel();
jScrollPane3 = new javax.swing.JScrollPane();
jTblStudenti = new javax.swing.JTable();
jbtnAnnulla = new javax.swing.JButton();
jLblTitolo = new javax.swing.JLabel();
jbtnSu = new javax.swing.JButton();
jbtnGiu = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Ultimi Movimenti");
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosed(java.awt.event.WindowEvent evt) {
formWindowClosed(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);
jbtnAnnulla.setFont(new java.awt.Font("Tahoma", 1, 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("Ultimi Movimenti");
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(8, 8, 8))
.addGroup(pnl1Layout.createSequentialGroup()
.addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 768, Short.MAX_VALUE)
.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()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jbtnAnnulla, javax.swing.GroupLayout.PREFERRED_SIZE, 215, 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.LEADING)
.addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 225, 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, 0, Short.MAX_VALUE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jbtnAnnulla, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 850, 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, 307, 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();
}// </editor-fold>//GEN-END:initComponents
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){
MyKeyBoard myk=new MyKeyBoard(this,false);
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 formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
try{
frmPuntoCassa.setEnabled(true);
//KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(frmPuntoCassa.keyDispatcher);
frmPuntoCassa.addRemoveKeyDispatcher(true);
frmPuntoCassa.toFront();
frmPuntoCassa.repaint();
frmPuntoCassa=null;
this.dispose();
}catch(Exception ex){}
}//GEN-LAST:event_formWindowClosed
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()<jTblStudenti.getRowCount()-1){
jTblStudenti.setRowSelectionInterval(jTblStudenti.getSelectedRow()+1, jTblStudenti.getSelectedRow()+1);
jTblStudenti.scrollRectToVisible(new Rectangle(jTblStudenti.getCellRect(jTblStudenti.getSelectedRow(), 0, true)));
}
}//GEN-LAST:event_jbtnGiuActionPerformed
private Boolean MyInsert(String Query) {
Boolean res=false;
try {
Connection dbConnection = DriverManager.getConnection(frmPuntoCassa.dbStringa, frmPuntoCassa.dbUsername, frmPuntoCassa.dbPassword);
Statement st = dbConnection.createStatement();
ResultSet rs = st.executeQuery(Query);
rs.close();
st.close();
dbConnection.close();
res=true;
} catch (SQLException e) {
JOptionPane.showMessageDialog(this, "Errore MySelect ['" + e.getMessage() + " " + Query + "']");
}
return res;
}
private void QueryDati(String Query,String QueryCount,String[] Colonne,String[] ColType, JTable jTbl,Boolean Editable){
try{
MyApplication MyA=new MyApplication();
MyTableModel model = new MyTableModel( );
model.setColumname(Colonne);
// model.setEditable(Editable);
// int [] colBool=new int[1];
// colBool[0]=7;
// model.setColBoolean(colBool);
// int[] cols=new int[1];
// cols[0]=7;
// model.setColModificabile(cols);
int rowCount=Integer.parseInt(Utils.mySelect(QueryCount, "righe", frmPuntoCassa));
Object[][] data = RowData(Query, Colonne,ColType,rowCount);
model.setData(data);
try{jTbl.setModel(model);}catch(Exception e){}
jTbl.setAutoCreateColumnsFromModel(true);
jTbl.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
jTbl.getTableHeader().setFont(new Font("Tahoma", Font.BOLD, 16));
jTbl.setFont(new Font("Tahoma", 0, 16));
TableColumn column = jTbl.getColumn("id");
column.setMinWidth(0);
column.setMaxWidth(0);
column.setWidth(0);
column.setPreferredWidth(0);
TableColumn column1 = jTbl.getColumn("Numero");
column1.setPreferredWidth(80);
column1.setWidth(80);
TableColumn column2 = jTbl.getColumn("Cognome");
column2.setPreferredWidth(150);
column2.setWidth(150);
TableColumn column11 = jTbl.getColumn("Data");
column11.setPreferredWidth(180);
column11.setWidth(180);
model.fireTableDataChanged();
doLayout();
}catch(NumberFormatException e){
System.out.println("Query: " + e.getMessage());
}
}
private void Aggiorna() {
try {
String From=" from view_ultimi_passaggi ";
// String Where= "where id_tessera=" + idTessera + " and flag_in_vassoio=0 and id_punto_cassa=" + idPuntoCassa ;
String[] Col = {"id", "Numero", "Fascia","Cognome","Nome","Data","Prodotto","Pagamento"};
String[] ColType = {"long", "text", "text", "text", "text", "data","text","text"};
String QueryCount="Select count(*) as righe from (Select * " + From + ") where ROWNUM <=50";
QueryDati("Select * from (select * " + From +") where ROWNUM <=50", QueryCount, Col, ColType, jTblStudenti, false);
//jTblStudenti.getColumn("Drawing").setPreferredWidth(200);
Font f=new Font("Tahoma",0,18);
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){
String Ora="";
if(d[2].length()>8){
String[] dx=d[2].trim().split(" ");
if(dx.length>1){
Ora=dx[1].substring(0,8);
}
}
row[i] = d[2].trim().substring(0, 2) + "/" + d[1] + "/" + d[0] + " " + Ora;
}
}
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 */
//<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(FrmMovimenti.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmMovimenti.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmMovimenti.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmMovimenti.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new FrmMovimenti(null,0L,0L,null).setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
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.JPanel pnl1;
// End of variables declaration//GEN-END:variables
}

View File

@ -27,7 +27,7 @@ import puntocassa.utils.Utils;
* *
* @author Marco * @author Marco
*/ */
public class FrmMovimenti extends javax.swing.JFrame { public class FrmMovimentiNew extends javax.swing.JFrame {
private PuntoCassa frmPuntoCassa; private PuntoCassa frmPuntoCassa;
private Long idTessera=0L,idPuntoCassa=0L; private Long idTessera=0L,idPuntoCassa=0L;
@ -40,7 +40,7 @@ public class FrmMovimenti extends javax.swing.JFrame {
/** /**
* Creates new form frm * Creates new form frm
*/ */
public FrmMovimenti(PuntoCassa frm,Long IDTessera,Long IDPuntoCassa,String imgPath) { public FrmMovimentiNew(PuntoCassa frm,Long IDTessera,Long IDPuntoCassa,String imgPath) {
frmPuntoCassa=frm; frmPuntoCassa=frm;
frmPuntoCassa.setEnabled(false); frmPuntoCassa.setEnabled(false);
@ -483,23 +483,27 @@ public class FrmMovimenti extends javax.swing.JFrame {
} }
} }
} catch (ClassNotFoundException ex) { } catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmMovimenti.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(FrmMovimentiNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) { } catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmMovimenti.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(FrmMovimentiNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) { } catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmMovimenti.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(FrmMovimentiNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) { } catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmMovimenti.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(FrmMovimentiNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} }
//</editor-fold> //</editor-fold>
//</editor-fold> //</editor-fold>
//</editor-fold> //</editor-fold>
//</editor-fold> //</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
/* Create and display the form */ /* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() { java.awt.EventQueue.invokeLater(new Runnable() {
public void run() { public void run() {
new FrmMovimenti(null,0L,0L,null).setVisible(true); new FrmMovimentiNew(null,0L,0L,null).setVisible(true);
} }
}); });
} }

View File

@ -30,7 +30,7 @@ import puntocassa.utils.Utils;
* *
* @author Marco * @author Marco
*/ */
public class FrmProdotti extends javax.swing.JFrame { public class FrmProdottiNew extends javax.swing.JFrame {
private PuntoCassa frmPuntoCassa; private PuntoCassa frmPuntoCassa;
@ -43,7 +43,7 @@ private PuntoCassa frmPuntoCassa;
/** /**
* Creates new form frm * Creates new form frm
*/ */
public FrmProdotti(PuntoCassa frm,String imgPath) { public FrmProdottiNew(PuntoCassa frm,String imgPath) {
frmPuntoCassa=frm; frmPuntoCassa=frm;
frmPuntoCassa.setEnabled(false); frmPuntoCassa.setEnabled(false);
@ -678,21 +678,23 @@ private PuntoCassa frmPuntoCassa;
} }
} }
} catch (ClassNotFoundException ex) { } catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmProdotti.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(FrmProdottiNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) { } catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmProdotti.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(FrmProdottiNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) { } catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmProdotti.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(FrmProdottiNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) { } catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmProdotti.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(FrmProdottiNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} }
//</editor-fold> //</editor-fold>
//</editor-fold> //</editor-fold>
//</editor-fold>
//</editor-fold>
/* Create and display the form */ /* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() { java.awt.EventQueue.invokeLater(new Runnable() {
public void run() { public void run() {
new FrmProdotti(null,null).setVisible(true); new FrmProdottiNew(null,null).setVisible(true);
} }
}); });
} }

View File

@ -1,143 +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.io.File;
import javax.swing.ImageIcon;
/**
*
* @author Marco
*/
public class FrmProgress extends javax.swing.JFrame {
private PuntoCassa frmPuntoCassa;
/**
* Creates new form frm
*/
public FrmProgress(PuntoCassa frm) {
frmPuntoCassa=frm;
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());
}
}
/**
* 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">//GEN-BEGIN:initComponents
private void initComponents() {
pnl1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Aggiorna database...");
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
setResizable(false);
setType(java.awt.Window.Type.POPUP);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosed(java.awt.event.WindowEvent evt) {
formWindowClosed(evt);
}
});
jLabel1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel1.setText("Aggiornamento in corso...");
jLabel1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
javax.swing.GroupLayout pnl1Layout = new javax.swing.GroupLayout(pnl1);
pnl1.setLayout(pnl1Layout);
pnl1Layout.setHorizontalGroup(
pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 377, Short.MAX_VALUE)
);
pnl1Layout.setVerticalGroup(
pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 104, Short.MAX_VALUE)
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(pnl1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(pnl1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
try{
frmPuntoCassa.setEnabled(true);
frmPuntoCassa.toFront();
frmPuntoCassa.repaint();
frmPuntoCassa=null;
this.dispose();
}catch(Exception ex){}
}//GEN-LAST:event_formWindowClosed
/**
* @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(FrmProgress.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmProgress.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmProgress.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmProgress.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new FrmProgress(null).setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel pnl1;
// End of variables declaration//GEN-END:variables
}

View File

@ -13,14 +13,14 @@ import javax.swing.ImageIcon;
* *
* @author Marco * @author Marco
*/ */
public class FrmProgress extends javax.swing.JFrame { public class FrmProgressNew extends javax.swing.JFrame {
private PuntoCassa frmPuntoCassa; private PuntoCassa frmPuntoCassa;
/** /**
* Creates new form frm * Creates new form frm
*/ */
public FrmProgress(PuntoCassa frm) { public FrmProgressNew(PuntoCassa frm) {
frmPuntoCassa=frm; frmPuntoCassa=frm;
initComponents(); initComponents();
String startDir = System.getProperty("user.dir"); String startDir = System.getProperty("user.dir");
@ -117,21 +117,23 @@ public class FrmProgress extends javax.swing.JFrame {
} }
} }
} catch (ClassNotFoundException ex) { } catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmProgress.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(FrmProgressNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) { } catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmProgress.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(FrmProgressNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) { } catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmProgress.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(FrmProgressNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) { } catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmProgress.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(FrmProgressNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} }
//</editor-fold> //</editor-fold>
//</editor-fold> //</editor-fold>
//</editor-fold>
//</editor-fold>
/* Create and display the form */ /* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() { java.awt.EventQueue.invokeLater(new Runnable() {
public void run() { public void run() {
new FrmProgress(null).setVisible(true); new FrmProgressNew(null).setVisible(true);
} }
}); });
} }

View File

@ -1,586 +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.Font;
import java.awt.Image;
import java.awt.Rectangle;
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 FrmStorno extends javax.swing.JFrame {
private PuntoCassa frmPuntoCassa;
private Long idTessera=0L,idPuntoCassa=0L;
public int HFont = 15;
private int AltControlli = 100;
private int LargControlli = 100;
private int AltRigaGriglia = 0;
private Boolean Azzera=false;
private Boolean StornoEffettuato=false;
/**
* Creates new form frm
*/
public FrmStorno(PuntoCassa frm,Long IDTessera,Long IDPuntoCassa,String imgPath,Boolean azzera) {
frmPuntoCassa=frm;
frmPuntoCassa.setEnabled(false);
//KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(frmPuntoCassa.keyDispatcher);
frmPuntoCassa.addRemoveKeyDispatcher(false);
idPuntoCassa=IDPuntoCassa;
idTessera=IDTessera;
Azzera=azzera;
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);
Aggiorna();
}
/**
* 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">//GEN-BEGIN:initComponents
private void initComponents() {
pnl1 = new javax.swing.JPanel();
jScrollPane3 = new javax.swing.JScrollPane();
jTblStudenti = new javax.swing.JTable();
jbtnAnnulla = new javax.swing.JButton();
jLblTitolo = new javax.swing.JLabel();
jBtnOK = new javax.swing.JButton();
jbtnSu = new javax.swing.JButton();
jbtnGiu = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Storno");
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosed(java.awt.event.WindowEvent evt) {
formWindowClosed(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);
jbtnAnnulla.setFont(new java.awt.Font("Tahoma", 1, 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("Storno");
jBtnOK.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jBtnOK.setText("Storna");
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(8, 8, 8))
.addGroup(pnl1Layout.createSequentialGroup()
.addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 768, Short.MAX_VALUE)
.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()
.addComponent(jBtnOK, javax.swing.GroupLayout.PREFERRED_SIZE, 215, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jbtnAnnulla, javax.swing.GroupLayout.PREFERRED_SIZE, 215, 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.LEADING)
.addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 223, 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, 0, Short.MAX_VALUE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jBtnOK, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jbtnAnnulla, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 850, 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, 307, 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();
}// </editor-fold>//GEN-END:initComponents
private void jbtnAnnullaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnAnnullaActionPerformed
// ClearTable((MyTableModel)jTblStudenti.getModel());
// frmPuntoCassa.setEnabled(true);
// frmPuntoCassa=null;
// if (Azzera){
// frmPuntoCassa.AzzeraDopoStorno();
// }
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){
MyKeyBoard myk=new MyKeyBoard(this,false);
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 formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
try{
frmPuntoCassa.setEnabled(true);
//KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(frmPuntoCassa.keyDispatcher);
frmPuntoCassa.addRemoveKeyDispatcher(true);
frmPuntoCassa.toFront();
frmPuntoCassa.repaint();
if (Azzera && StornoEffettuato==false){
frmPuntoCassa.azzeraDopoStorno();
}
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();
Object[]row = model.getRow(jTblStudenti.getSelectedRow());
// QueryDati("select a.id 0,a.data 1,a.num_progressivo as Progressivo 2,p.nome as Prodotto,a.importo 4,a.punti 5,a.saldo_pre,a.saldo_post,a.punti_pre,a.punti_post,p.id as idProdotto " + From + Where + " order by a.data,a.num_progressivo", QueryCount, Col, ColType, jTblStudenti, false);
//Boolean Ok=MyInsert("insert into ristorni (ID_TESSERA,ID_PRODOTTO,ID_PUNTO_CASSA,DATA,NUM_PROGRESSIVO,IMPORTO,PUNTI,ID_TIPO_PAGAMENTO,ID_TURNO) " +
// "values (" + idTessera + "," + row[1] + "," + idPuntoCassa + ",to_date('" + row[2] + "','dd/mm/yyyy HH24:MI:SS')," + row[3] + ","+ row[5] + "," + row[6] + "," + row[7] + "," + row[8] + ")");
Boolean Ok=MyInsert("insert into ristorni (ID_TESSERA,ID_PRODOTTO,ID_PUNTO_CASSA,DATA,NUM_PROGRESSIVO,IMPORTO,PUNTI,ID_TIPO_PAGAMENTO,ID_TURNO,FLAG_IN_VASSOIO,SALDO_PRE,SALDO_POST,PUNTI_PRE,PUNTI_POST,FLAG_GRATUITA,FLAG_ASPORTO,FLAG_BONUS) " +
"SELECT ID_TESSERA,ID_PRODOTTO,ID_PUNTO_CASSA,DATA,NUM_PROGRESSIVO,IMPORTO,PUNTI,ID_TIPO_PAGAMENTO,ID_TURNO,FLAG_IN_VASSOIO,SALDO_PRE,SALDO_POST,PUNTI_PRE,PUNTI_POST,FLAG_GRATUITA,FLAG_ASPORTO,FLAG_BONUS " +
"FROM st_acquisti WHERE num_progressivo = " + row[3]);
if(Ok){
//MyInsert("Delete from St_Acquisti where id="+ row[0]);
MyInsert("Delete from St_Acquisti where num_progressivo="+ row[3]);
StornoEffettuato=true;
}
if (Azzera){
// frmPuntoCassa.AzzeraDopoStorno();
}else
{
frmPuntoCassa.aggiornaProgressivi();
}
//frmPuntoCassa.CercaTessera();
this.dispose();
}
}//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()<jTblStudenti.getRowCount()-1){
jTblStudenti.setRowSelectionInterval(jTblStudenti.getSelectedRow()+1, jTblStudenti.getSelectedRow()+1);
jTblStudenti.scrollRectToVisible(new Rectangle(jTblStudenti.getCellRect(jTblStudenti.getSelectedRow(), 0, true)));
}
}//GEN-LAST:event_jbtnGiuActionPerformed
private Boolean MyInsert(String Query) {
Boolean res=false;
try {
Connection dbConnection = DriverManager.getConnection(frmPuntoCassa.dbStringa, frmPuntoCassa.dbUsername, frmPuntoCassa.dbPassword);
Statement st = dbConnection.createStatement();
ResultSet rs = st.executeQuery(Query);
rs.close();
st.close();
dbConnection.close();
res=true;
} catch (SQLException e) {
JOptionPane.showMessageDialog(this, "Errore MySelect ['" + e.getMessage() + " " + Query + "']");
}
return res;
}
private void QueryDati(String Query,String QueryCount,String[] Colonne,String[] ColType, JTable jTbl,Boolean Editable){
try{
MyApplication MyA=new MyApplication();
MyTableModel model = new MyTableModel( );
model.setColumname(Colonne);
// model.setEditable(Editable);
// int [] colBool=new int[1];
// colBool[0]=7;
// model.setColBoolean(colBool);
// int[] cols=new int[1];
// cols[0]=7;
// model.setColModificabile(cols);
int rowCount=Integer.parseInt(Utils.mySelect(QueryCount, "righe", frmPuntoCassa));
Object[][] data = RowData(Query, Colonne,ColType,rowCount);
model.setData(data);
try{jTbl.setModel(model);}catch(Exception e){}
jTbl.setAutoCreateColumnsFromModel(true);
jTbl.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
jTbl.getTableHeader().setFont(new Font("Tahoma", Font.BOLD, 16));
jTbl.setFont(new Font("Tahoma", 0, 16));
TableColumn column = jTbl.getColumn("id");
column.setMinWidth(0);
column.setMaxWidth(0);
column.setWidth(0);
column.setPreferredWidth(0);
TableColumn column2 = jTbl.getColumn("idProdotto");
column2.setMinWidth(0);
column2.setMaxWidth(0);
column2.setWidth(0);
column2.setPreferredWidth(0);
TableColumn column3 = jTbl.getColumn("id_Tipo_Pagamento");
column3.setMinWidth(0);
column3.setMaxWidth(0);
column3.setWidth(0);
column3.setPreferredWidth(0);
TableColumn column4 = jTbl.getColumn("id_Turno");
column4.setMinWidth(0);
column4.setMaxWidth(0);
column4.setWidth(0);
column4.setPreferredWidth(0);
TableColumn column1 = jTbl.getColumn("Prodotto");
column1.setPreferredWidth(280);
column1.setWidth(280);
TableColumn column11 = jTbl.getColumn("Data");
column11.setPreferredWidth(180);
column11.setWidth(180);
model.fireTableDataChanged();
doLayout();
}catch(NumberFormatException e){
System.out.println("Query: " + e.getMessage());
}
}
private void Aggiorna() {
try {
String From=" from st_acquisti a inner join prodotti p on a.id_prodotto=p.id inner join Tipi_Pagamenti tp on a.id_tipo_pagamento=tp.id ";
String Where= "where TRUNC(data) = TRUNC(SYSDATE) and id_tessera=" + idTessera + " and flag_in_vassoio=0 and id_punto_cassa=" + idPuntoCassa ;
// String Where= " and UPPER(Cognome) like '" + jtxtCognome.getText().trim().toUpperCase().replace("'", "''") + "%' ";
// if (jtxtNome.getText().trim().length()>0) {Where=Where + " and UPPER(Nome) like '" + jtxtNome.getText().trim().toUpperCase().replace("'", "''") + "%'"; }
// if (jtxtCodFis.getText().trim().length()>0) {Where=Where + " and UPPER(Matricola) like '" + jtxtCodFis.getText().trim().toUpperCase().replace("'", "''") + "%'"; }
String[] Col = {"id", "idProdotto", "Data","Progressivo","Prodotto","Importo","id_Tipo_Pagamento","id_Turno","Pagamento"};
String[] ColType = {"long", "long", "data","integer", "text", "float", "long", "long", "text"};
String QueryCount="Select count(*) as righe " + From + Where;
QueryDati("select a.id,p.id as idProdotto,a.data,a.num_progressivo as Progressivo,p.nome as Prodotto,a.importo,a.id_tipo_pagamento,a.id_turno,tp.Nome as Pagamento " + From + Where + " order by a.data desc,a.num_progressivo desc", QueryCount, Col, ColType, jTblStudenti, false);
//jTblStudenti.getColumn("Drawing").setPreferredWidth(200);
Font f=new Font("Tahoma",0,18);
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){
String Ora="";
if(d[2].length()>8){
String O[]=d[2].trim().split(" ");
if(O.length>1){
if(O[1].length()>=8){
Ora=O[1].substring(0, 8);
}
}
}
row[i] = d[2].trim().substring(0, 2) + "/" + d[1] + "/" + d[0] + " " + Ora;
}
}
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 */
//<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(FrmStorno.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmStorno.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmStorno.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmStorno.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new FrmStorno(null,0L,0L,null,false).setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
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.JPanel pnl1;
// End of variables declaration//GEN-END:variables
}

View File

@ -27,7 +27,7 @@ import puntocassa.utils.Utils;
* *
* @author Marco * @author Marco
*/ */
public class FrmStorno extends javax.swing.JFrame { public class FrmStornoNew extends javax.swing.JFrame {
private PuntoCassa frmPuntoCassa; private PuntoCassa frmPuntoCassa;
private Long idTessera=0L,idPuntoCassa=0L; private Long idTessera=0L,idPuntoCassa=0L;
@ -41,7 +41,7 @@ public class FrmStorno extends javax.swing.JFrame {
/** /**
* Creates new form frm * Creates new form frm
*/ */
public FrmStorno(PuntoCassa frm,Long IDTessera,Long IDPuntoCassa,String imgPath,Boolean azzera) { public FrmStornoNew(PuntoCassa frm,Long IDTessera,Long IDPuntoCassa,String imgPath,Boolean azzera) {
frmPuntoCassa=frm; frmPuntoCassa=frm;
frmPuntoCassa.setEnabled(false); frmPuntoCassa.setEnabled(false);
@ -554,21 +554,23 @@ public class FrmStorno extends javax.swing.JFrame {
} }
} }
} catch (ClassNotFoundException ex) { } catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmStorno.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(FrmStornoNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) { } catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmStorno.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(FrmStornoNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) { } catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmStorno.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(FrmStornoNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) { } catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmStorno.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(FrmStornoNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} }
//</editor-fold> //</editor-fold>
//</editor-fold> //</editor-fold>
//</editor-fold>
//</editor-fold>
/* Create and display the form */ /* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() { java.awt.EventQueue.invokeLater(new Runnable() {
public void run() { public void run() {
new FrmStorno(null,0L,0L,null,false).setVisible(true); new FrmStornoNew(null,0L,0L,null,false).setVisible(true);
} }
}); });
} }

View File

@ -189,8 +189,8 @@ public class MyKeyBoard extends javax.swing.JFrame {
private void jBtnInvioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnInvioActionPerformed private void jBtnInvioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnInvioActionPerformed
if (formCerca) { if (formCerca) {
FrmCerca frm; FrmCercaNew frm;
frm = (FrmCerca) parent; frm = (FrmCercaNew) parent;
frm.Cerca(); frm.Cerca();
} }

View File

@ -123,8 +123,8 @@ public class PuntoCassa extends JFrame implements ActionListener {
public int hFont = 15; public int hFont = 15;
private int altControlli = 100; private int altControlli = 100;
private int largControlli = 100; private int largControlli = 100;
public FrmProgress myProgressForm; public FrmProgressNew myProgressForm;
public FrmMeteo myMeteoForm; public FrmMeteoNew myMeteoForm;
private int gratuitaResidue = 0; private int gratuitaResidue = 0;
private int bonusResidui = 0; private int bonusResidui = 0;
private StringBuilder modiPagamento = new StringBuilder(""); private StringBuilder modiPagamento = new StringBuilder("");
@ -2694,7 +2694,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
this); this);
if (Integer.parseInt(spia) == 1) { if (Integer.parseInt(spia) == 1) {
if (myMeteoForm == null) { if (myMeteoForm == null) {
myMeteoForm = new FrmMeteo(this, idPuntoCassa, true); myMeteoForm = new FrmMeteoNew(this, idPuntoCassa, true);
this.setEnabled(false); this.setEnabled(false);
Integer w = calcolaLarghezzaAltezza(300, largControlli); Integer w = calcolaLarghezzaAltezza(300, largControlli);
@ -2938,7 +2938,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
}//GEN-LAST:event_jBtnStornoActionPerformed }//GEN-LAST:event_jBtnStornoActionPerformed
private void apriStorno(Boolean daPassaggi) { private void apriStorno(Boolean daPassaggi) {
FrmStorno jFrameStorno = new FrmStorno(this, idTessera, idPuntoCassa, imgPath, daPassaggi); FrmStornoNew jFrameStorno = new FrmStornoNew(this, idTessera, idPuntoCassa, imgPath, daPassaggi);
this.setEnabled(false); this.setEnabled(false);
Integer w = calcolaLarghezzaAltezza(550, largControlli); Integer w = calcolaLarghezzaAltezza(550, largControlli);
Integer h = calcolaLarghezzaAltezza(250, altControlli); Integer h = calcolaLarghezzaAltezza(250, altControlli);
@ -2948,7 +2948,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
jFrameStorno.setVisible(true); jFrameStorno.setVisible(true);
} }
private void jBtnprodottiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnprodottiActionPerformed private void jBtnprodottiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnprodottiActionPerformed
FrmProdotti jFrameProdotti = new FrmProdotti(this, imgPath); FrmProdottiNew jFrameProdotti = new FrmProdottiNew(this, imgPath);
this.setEnabled(false); this.setEnabled(false);
Integer w = calcolaLarghezzaAltezza(550, largControlli); Integer w = calcolaLarghezzaAltezza(550, largControlli);
@ -3014,7 +3014,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
} }
if (aggiorna) { if (aggiorna) {
myProgressForm = new FrmProgress(this); myProgressForm = new FrmProgressNew(this);
this.setEnabled(false); this.setEnabled(false);
Integer w = calcolaLarghezzaAltezza(300, largControlli); Integer w = calcolaLarghezzaAltezza(300, largControlli);
@ -3086,7 +3086,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
}//GEN-LAST:event_jTxtTesseraFocusGained }//GEN-LAST:event_jTxtTesseraFocusGained
private void btnImpostaClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnImpostaClienteActionPerformed 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); this.setEnabled(false);
Integer w = calcolaLarghezzaAltezza(650, largControlli); Integer w = calcolaLarghezzaAltezza(650, largControlli);
@ -3156,7 +3156,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
}//GEN-LAST:event_txtTotalePuntiActionPerformed }//GEN-LAST:event_txtTotalePuntiActionPerformed
private void jBtnMovimentiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnMovimentiActionPerformed private void jBtnMovimentiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnMovimentiActionPerformed
FrmMovimenti jFrameMovimenti = new FrmMovimenti(this, idTessera, idPuntoCassa, imgPath); FrmMovimentiNew jFrameMovimenti = new FrmMovimentiNew(this, idTessera, idPuntoCassa, imgPath);
this.setEnabled(false); this.setEnabled(false);
Integer w = calcolaLarghezzaAltezza(680, largControlli); Integer w = calcolaLarghezzaAltezza(680, largControlli);
@ -3170,7 +3170,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
private void jBtnBuoniActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnBuoniActionPerformed 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); this.setEnabled(false);
Integer w = calcolaLarghezzaAltezza(650, largControlli); Integer w = calcolaLarghezzaAltezza(650, largControlli);
Integer h = calcolaLarghezzaAltezza(250, altControlli); Integer h = calcolaLarghezzaAltezza(250, altControlli);

View File

@ -1,269 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" value="Cerca Tessera Attiva"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<Events>
<EventHandler event="windowClosed" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowClosed"/>
</Events>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="845" max="32767" attributes="0"/>
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Component id="pnl1" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="322" max="32767" attributes="0"/>
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="pnl1" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="pnl1">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jLblTitolo" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="256" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jtxtCognome" min="-2" pref="177" max="-2" attributes="0"/>
<Component id="lblCognome" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="lblNome" min="-2" max="-2" attributes="0"/>
<Component id="jtxtNome" min="-2" pref="181" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="lblCF" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="jtxtNumTessera" min="-2" pref="176" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jBtnCerca" pref="128" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jbtnAnnulla" pref="135" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
<Component id="jBtnOK" min="-2" pref="97" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Component id="jScrollPane3" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jbtnSu" min="-2" pref="60" max="-2" attributes="0"/>
<Component id="jbtnGiu" min="-2" pref="60" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jLblTitolo" min="-2" pref="25" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="lblCognome" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblNome" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblCF" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jtxtNumTessera" alignment="3" min="-2" pref="40" max="-2" attributes="0"/>
<Component id="jBtnCerca" alignment="3" min="-2" pref="40" max="-2" attributes="0"/>
<Component id="jbtnAnnulla" alignment="3" min="-2" pref="40" max="-2" attributes="0"/>
</Group>
<Component id="jtxtNome" alignment="1" max="32767" attributes="0"/>
<Component id="jtxtCognome" alignment="1" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane3" pref="0" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="jbtnSu" min="-2" pref="55" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jbtnGiu" min="-2" pref="53" max="-2" attributes="0"/>
<EmptySpace min="0" pref="50" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jBtnOK" min="-2" pref="36" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="lblCF">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="Num. Tessera:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lblNome">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="Nome:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lblCognome">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="Cognome:"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jBtnCerca">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="Cerca"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jBtnCercaActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane3">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTable" name="jTblStudenti">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="14" style="0"/>
</Property>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
<Table columnCount="0" rowCount="4"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JTextField" name="jtxtCognome">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="0"/>
</Property>
</Properties>
<Events>
<EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="jtxtCognomeFocusGained"/>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jtxtCognomeMouseClicked"/>
</Events>
</Component>
<Component class="javax.swing.JTextField" name="jtxtNome">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="0"/>
</Property>
</Properties>
<Events>
<EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="jtxtNomeFocusGained"/>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jtxtNomeMouseClicked"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jbtnAnnulla">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="Annulla"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jbtnAnnullaActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLblTitolo">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="0" green="0" red="ff" type="rgb"/>
</Property>
<Property name="horizontalAlignment" type="int" value="2"/>
<Property name="text" type="java.lang.String" value="Cerca Tessera Attiva"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jtxtNumTessera">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="0"/>
</Property>
</Properties>
<Events>
<EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="jtxtNumTesseraFocusGained"/>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jtxtNumTesseraMouseClicked"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jBtnOK">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="OK"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jBtnOKActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jbtnSu">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jbtnSuActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jbtnGiu">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jbtnGiuActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@ -1,99 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" value="Aggiorna condizioni Meteo"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<Events>
<EventHandler event="windowClosed" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowClosed"/>
</Events>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="pnl1" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="pnl1" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="pnl1">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jCmbCat" pref="238" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jBtnAggiorna" min="-2" pref="97" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jCmbCat" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jBtnAggiorna" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="jBtnAggiorna">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="Aggiorna"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jBtnAggiornaActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JComboBox" name="jCmbCat">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="14" style="0"/>
</Property>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@ -1,152 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" value="Ultimi Movimenti"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<Events>
<EventHandler event="windowClosed" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowClosed"/>
</Events>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="850" max="32767" attributes="0"/>
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Component id="pnl1" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="307" max="32767" attributes="0"/>
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="pnl1" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="pnl1">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jLblTitolo" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jScrollPane3" pref="768" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jbtnSu" alignment="0" min="-2" pref="60" max="-2" attributes="0"/>
<Component id="jbtnGiu" alignment="0" min="-2" pref="60" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="jbtnAnnulla" min="-2" pref="215" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jLblTitolo" min="-2" pref="25" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane3" pref="225" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="jbtnSu" min="-2" pref="55" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jbtnGiu" min="-2" pref="53" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jbtnAnnulla" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane3">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTable" name="jTblStudenti">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="14" style="0"/>
</Property>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
<Table columnCount="0" rowCount="4"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="jbtnAnnulla">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Annulla"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jbtnAnnullaActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLblTitolo">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="0" green="0" red="ff" type="rgb"/>
</Property>
<Property name="horizontalAlignment" type="int" value="2"/>
<Property name="text" type="java.lang.String" value="Ultimi Movimenti"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jbtnSu">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jbtnSuActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jbtnGiu">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jbtnGiuActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@ -1,290 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" value="Cerca Prodotto"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<Events>
<EventHandler event="windowClosed" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowClosed"/>
</Events>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="pnl1" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="pnl1" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="pnl1">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="lblCognome" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="180" max="32767" attributes="0"/>
</Group>
<Component id="jCmbCat" pref="274" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="lblCognome1" min="-2" max="-2" attributes="0"/>
<Component id="jtxtCodice" min="-2" pref="130" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="lblCognome2" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jtxtProdotto" pref="121" max="32767" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jBtnCerca" min="-2" pref="97" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jbtnAnnulla2" min="-2" pref="93" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="jLblTitolo" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" attributes="0">
<Component id="jbtnAggiungi" min="-2" pref="261" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jbtnElimina" min="-2" pref="261" max="-2" attributes="0"/>
</Group>
<Component id="jScrollPane3" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jbtnSu" alignment="0" min="-2" pref="60" max="-2" attributes="0"/>
<Component id="jbtnGiu" alignment="0" min="-2" pref="60" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jLblTitolo" min="-2" pref="25" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
<Component id="lblCognome1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblCognome" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="lblCognome2" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<EmptySpace min="21" pref="21" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
<Component id="jCmbCat" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jbtnAnnulla2" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jBtnCerca" alignment="0" max="32767" attributes="0"/>
<Component id="jtxtCodice" alignment="0" max="32767" attributes="0"/>
<Component id="jtxtProdotto" alignment="0" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane3" pref="170" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="jbtnSu" min="-2" pref="55" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jbtnGiu" min="-2" pref="53" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jbtnAggiungi" alignment="3" min="-2" pref="30" max="-2" attributes="0"/>
<Component id="jbtnElimina" alignment="3" min="-2" pref="30" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane3">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTable" name="jTblProdotti">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="1"/>
</Property>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
<Table columnCount="0" rowCount="4"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="jLblTitolo">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="0" green="0" red="ff" type="rgb"/>
</Property>
<Property name="horizontalAlignment" type="int" value="2"/>
<Property name="text" type="java.lang.String" value="Cerca Prodotti"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jbtnAggiungi">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Aggiungi Prodotto"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jbtnAggiungiActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="lblCognome">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Categoria:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jtxtCodice">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="1"/>
</Property>
</Properties>
<Events>
<EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="jtxtCodiceFocusGained"/>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jtxtCodiceMouseClicked"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jBtnCerca">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Cerca"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jBtnCercaActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jbtnAnnulla2">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="Annulla"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jbtnAnnulla2ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JComboBox" name="jCmbCat">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="1"/>
</Property>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lblCognome1">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Codice:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jtxtProdotto">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="1"/>
</Property>
</Properties>
<Events>
<EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="jtxtProdottoFocusGained"/>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jtxtProdottoMouseClicked"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="lblCognome2">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Prodotto:"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jbtnSu">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jbtnSuActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jbtnGiu">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jbtnGiuActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jbtnElimina">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Elimina Prodotto"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jbtnEliminaActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@ -1,744 +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.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.JComboBox;
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 FrmProdotti extends javax.swing.JFrame {
private PuntoCassa frmPuntoCassa;
public int HFont=15;
private int AltControlli=100;
private int LargControlli=100;
private int AltRigaGriglia=0;
/**
* Creates new form frm
*/
public FrmProdotti(PuntoCassa frm,String imgPath) {
frmPuntoCassa=frm;
frmPuntoCassa.setEnabled(false);
//KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(frmPuntoCassa.keyDispatcher);
frmPuntoCassa.addRemoveKeyDispatcher(false);
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
// --------------------------------------------------------------------
jTblProdotti.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);
}
}
});
CaricaCombo("Select nome,id from categorie_prodotti union select ' ' as nome,0 as id from categorie_prodotti order by nome", "nome", "id", jCmbCat);
}
/**
* 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">//GEN-BEGIN:initComponents
private void initComponents() {
pnl1 = new javax.swing.JPanel();
jScrollPane3 = new javax.swing.JScrollPane();
jTblProdotti = new javax.swing.JTable();
jLblTitolo = new javax.swing.JLabel();
jbtnAggiungi = new javax.swing.JButton();
lblCognome = new javax.swing.JLabel();
jtxtCodice = new javax.swing.JTextField();
jBtnCerca = new javax.swing.JButton();
jbtnAnnulla2 = new javax.swing.JButton();
jCmbCat = new javax.swing.JComboBox();
lblCognome1 = new javax.swing.JLabel();
jtxtProdotto = new javax.swing.JTextField();
lblCognome2 = new javax.swing.JLabel();
jbtnSu = new javax.swing.JButton();
jbtnGiu = new javax.swing.JButton();
jbtnElimina = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Cerca Prodotto");
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosed(java.awt.event.WindowEvent evt) {
formWindowClosed(evt);
}
});
jTblProdotti.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jTblProdotti.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{},
{},
{},
{}
},
new String [] {
}
));
jScrollPane3.setViewportView(jTblProdotti);
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 Prodotti");
jbtnAggiungi.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jbtnAggiungi.setText("Aggiungi Prodotto");
jbtnAggiungi.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtnAggiungiActionPerformed(evt);
}
});
lblCognome.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
lblCognome.setText("Categoria:");
jtxtCodice.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jtxtCodice.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
jtxtCodiceFocusGained(evt);
}
});
jtxtCodice.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jtxtCodiceMouseClicked(evt);
}
});
jBtnCerca.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jBtnCerca.setText("Cerca");
jBtnCerca.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBtnCercaActionPerformed(evt);
}
});
jbtnAnnulla2.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jbtnAnnulla2.setText("Annulla");
jbtnAnnulla2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtnAnnulla2ActionPerformed(evt);
}
});
jCmbCat.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jCmbCat.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
lblCognome1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
lblCognome1.setText("Codice:");
jtxtProdotto.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jtxtProdotto.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
jtxtProdottoFocusGained(evt);
}
});
jtxtProdotto.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jtxtProdottoMouseClicked(evt);
}
});
lblCognome2.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
lblCognome2.setText("Prodotto:");
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);
}
});
jbtnElimina.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jbtnElimina.setText("Elimina Prodotto");
jbtnElimina.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtnEliminaActionPerformed(evt);
}
});
javax.swing.GroupLayout pnl1Layout = new javax.swing.GroupLayout(pnl1);
pnl1.setLayout(pnl1Layout);
pnl1Layout.setHorizontalGroup(
pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnl1Layout.createSequentialGroup()
.addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnl1Layout.createSequentialGroup()
.addComponent(lblCognome)
.addGap(0, 180, Short.MAX_VALUE))
.addComponent(jCmbCat, 0, 274, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblCognome1)
.addComponent(jtxtCodice, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblCognome2)
.addGroup(pnl1Layout.createSequentialGroup()
.addComponent(jtxtProdotto, javax.swing.GroupLayout.DEFAULT_SIZE, 121, Short.MAX_VALUE)
.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(jbtnAnnulla2, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnl1Layout.createSequentialGroup()
.addComponent(jLblTitolo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(8, 8, 8))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnl1Layout.createSequentialGroup()
.addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(pnl1Layout.createSequentialGroup()
.addComponent(jbtnAggiungi, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jbtnElimina, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE))
.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))
.addContainerGap())
);
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.LEADING)
.addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblCognome1)
.addComponent(lblCognome))
.addComponent(lblCognome2)
.addGroup(pnl1Layout.createSequentialGroup()
.addGap(21, 21, 21)
.addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jCmbCat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jbtnAnnulla2))
.addComponent(jBtnCerca, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jtxtCodice)
.addComponent(jtxtProdotto))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 170, 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, 0, Short.MAX_VALUE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnl1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jbtnAggiungi, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jbtnElimina, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(pnl1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(pnl1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
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){
MyKeyBoard myk=new MyKeyBoard(this,false);
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 formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
try{
frmPuntoCassa.setEnabled(true);
//KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(frmPuntoCassa.keyDispatcher);
frmPuntoCassa.addRemoveKeyDispatcher(true);
frmPuntoCassa.toFront();
frmPuntoCassa.repaint();
frmPuntoCassa=null;
this.dispose();
}catch(Exception ex){}
}//GEN-LAST:event_formWindowClosed
private void jbtnAggiungiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnAggiungiActionPerformed
MyTableModel model = new MyTableModel();
model = (MyTableModel) jTblProdotti.getModel();
Long cod = 0L;
if (jTblProdotti.getSelectedRow() >= 0) {
cod = Long.parseLong(model.getValueAt(jTblProdotti.getSelectedRow(), 0).toString());
Boolean presente = Boolean.parseBoolean(model.getValueAt(jTblProdotti.getSelectedRow(), 4).toString());
if (presente == false) {
MyInsert("Insert into Catalogo_punti_cassa (id,id_prodotto,id_punto_cassa,flag_locale) values(-1," + cod + "," + frmPuntoCassa.idPuntoCassa + ",1)");
frmPuntoCassa.caricaDati("PRODOTTI", "-1");
this.dispose();
}
}
}//GEN-LAST:event_jbtnAggiungiActionPerformed
private Boolean MyInsert(String Query) {
Boolean res=false;
try {
Connection dbConnection = DriverManager.getConnection(frmPuntoCassa.dbStringa, frmPuntoCassa.dbUsername, frmPuntoCassa.dbPassword);
Statement st = dbConnection.createStatement();
ResultSet rs = st.executeQuery(Query);
rs.close();
st.close();
dbConnection.close();
res=true;
} catch (SQLException e) {
JOptionPane.showMessageDialog(this, "Errore MySelect ['" + e.getMessage() + " " + Query + "']");
}
return res;
}
private void jtxtCodiceFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jtxtCodiceFocusGained
Tastiera(evt);
// 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_jtxtCodiceFocusGained
private void jBtnCercaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnCercaActionPerformed
// if (jtxtProdotto.getText().trim().length()<=0){
// JOptionPane.showMessageDialog(this, "Inserire la descrizione del prodotto!","Attenzione",JOptionPane.INFORMATION_MESSAGE);
// return;
// }
Aggiorna();
}//GEN-LAST:event_jBtnCercaActionPerformed
private void jbtnAnnulla2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnAnnulla2ActionPerformed
// ClearTable((MyTableModel)jTblStudenti.getModel());
// frmPuntoCassa.setEnabled(true);
// frmPuntoCassa=null;
this.dispose();
}//GEN-LAST:event_jbtnAnnulla2ActionPerformed
private void jtxtProdottoFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jtxtProdottoFocusGained
Tastiera(evt);
}//GEN-LAST:event_jtxtProdottoFocusGained
private void jbtnSuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnSuActionPerformed
// TODO add your handling code here:
if(jTblProdotti.getSelectedRow()>0){
jTblProdotti.setRowSelectionInterval(jTblProdotti.getSelectedRow()-1, jTblProdotti.getSelectedRow()-1);
jTblProdotti.scrollRectToVisible(new Rectangle(jTblProdotti.getCellRect(jTblProdotti.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(jTblProdotti.getSelectedRow()<jTblProdotti.getRowCount()-1){
jTblProdotti.setRowSelectionInterval(jTblProdotti.getSelectedRow()+1, jTblProdotti.getSelectedRow()+1);
jTblProdotti.scrollRectToVisible(new Rectangle(jTblProdotti.getCellRect(jTblProdotti.getSelectedRow(), 0, true)));
}
}//GEN-LAST:event_jbtnGiuActionPerformed
private void jtxtCodiceMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jtxtCodiceMouseClicked
Tastiera(evt);
}//GEN-LAST:event_jtxtCodiceMouseClicked
private void jtxtProdottoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jtxtProdottoMouseClicked
Tastiera(evt);
}//GEN-LAST:event_jtxtProdottoMouseClicked
private void jbtnEliminaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnEliminaActionPerformed
MyTableModel model = new MyTableModel();
model = (MyTableModel) jTblProdotti.getModel();
Long cod = 0L;
if (jTblProdotti.getSelectedRow() >= 0) {
cod = Long.parseLong(model.getValueAt(jTblProdotti.getSelectedRow(), 0).toString());
Boolean presente = Boolean.parseBoolean(model.getValueAt(jTblProdotti.getSelectedRow(), 4).toString());
if (presente) {
MyInsert("Delete Catalogo_punti_cassa where id_prodotto=" + cod + " and id_punto_cassa=" + frmPuntoCassa.idPuntoCassa);
frmPuntoCassa.caricaDati("PRODOTTI", "-1");
this.dispose();
}
}
}//GEN-LAST:event_jbtnEliminaActionPerformed
private void Tastiera(java.awt.event.MouseEvent evt) {
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);
}
}
}
//java.awt.event.FocusEvent
private void Tastiera(java.awt.event.FocusEvent evt) {
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);
}
}
}
private void QueryDati(String Query,String QueryCount,String[] Colonne,String[] ColType, JTable jTbl,Boolean Editable){
try{
MyApplication MyA=new MyApplication();
MyTableModel model = new MyTableModel( );
model.setColumname(Colonne);
// model.setEditable(Editable);
// int [] colBool=new int[1];
// colBool[0]=7;
// model.setColBoolean(colBool);
// int[] cols=new int[1];
// cols[0]=7;
// model.setColModificabile(cols);
int rowCount=Integer.parseInt(Utils.mySelect(QueryCount, "righe", frmPuntoCassa));
Object[][] data = RowData(Query, Colonne,ColType,rowCount);
model.setData(data);
try{jTbl.setModel(model);}catch(Exception e){}
jTbl.setAutoCreateColumnsFromModel(true);
jTbl.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
jTbl.getTableHeader().setFont(new Font("Tahoma", Font.BOLD, 16));
jTbl.setFont(new Font("Tahoma", 0, 16));
TableColumn column = jTbl.getColumn("id");
column.setMinWidth(0);
column.setMaxWidth(0);
column.setWidth(0);
column.setPreferredWidth(0);
TableColumn column1 = jTbl.getColumn("Prodotto");
column1.setPreferredWidth(380);
column1.setWidth(380);
// TableColumn column2 = jTbl.getColumn("Codice");
// column2.setPreferredWidth(20);
model.fireTableDataChanged();
doLayout();
}catch(NumberFormatException e){
System.out.println("Query: " + e.getMessage());
}
}
private void Aggiorna() {
try {
String From=" from prodotti p, categorie_prodotti c ";
String Where = " WHERE p.id_categoria = c.id ";
if (jtxtCodice.getText().trim().length() > 0) {
Where = Where + " and upper(p.codice) like '" + jtxtCodice.getText().trim().replace("'", "''").toUpperCase() + "%' ";
}
if (jtxtProdotto.getText().trim().length() > 0) {
Where = Where + " and upper(p.nome) like '%" + jtxtProdotto.getText().trim().replace("'", "''").toUpperCase() + "%' ";
}
ComboItem c = new ComboItem(null, null);
c = (ComboItem) jCmbCat.getSelectedItem();
if (c.getKey() > 0) {
Where = Where + " and p.id_categoria = " + c.getKey();
}
String[] Col = {"id","Categoria","Codice","Prodotto","Presente"};
String[] ColType = {"long", "text","text","text","boolean"};
String QueryCount="Select count(*) as righe " + From + Where;
QueryDati("select p.id,c.nome as categoria,p.codice, p.nome as prodotto, prodotto_in_catalogo (p.id, " + frmPuntoCassa.idPuntoCassa + ") as presente " + From + Where + " order by c.nome,p.nome", QueryCount, Col, ColType, jTblProdotti, false);
//jTblStudenti.getColumn("Drawing").setPreferredWidth(200);
//Font f=new Font("Tahoma",0,HFont);
Font f=new Font("Tahoma",0,20);
jTblProdotti.setFont(f);
jTblProdotti.setFont(f);
if(AltRigaGriglia==0){AltRigaGriglia=jTblProdotti.getRowHeight();}
// txtUsername.setSize(CalcolaLarghezzaAltezza(txtUsername.getWidth(),LargControlli), CalcolaLarghezzaAltezza(txtUsername.getHeight(),AltControlli));
//jTblProdotti.setRowHeight(CalcolaLarghezzaAltezza(AltRigaGriglia,AltControlli));
jTblProdotti.setRowHeight(25);
//ClearTable((MyTableModel)jTblTessere.getModel());
if (jTblProdotti.getRowCount() > 0) {
jTblProdotti.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 "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 */
//<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(FrmProdotti.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmProdotti.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmProdotti.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmProdotti.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new FrmProdotti(null,null).setVisible(true);
}
});
}
private void CaricaCombo (String Query, String itemValue, String itemId, JComboBox cmb) {
try {
Connection dbConnection = DriverManager.getConnection(frmPuntoCassa.dbStringa, frmPuntoCassa.dbUsername, frmPuntoCassa.dbPassword);
Connection c = dbConnection;
Statement stmt = null;
cmb.removeAllItems();
stmt = c.createStatement();
ResultSet rs = stmt.executeQuery(Query);
int r = 0;
while (rs.next()) {
ComboItem row=new ComboItem(rs.getLong(itemId), rs.getString(itemValue)) ;
cmb.addItem(row);
r++;
}
rs.close();
stmt.close();
dbConnection.close();
} catch (SQLException e) {
System.err.println(e.getClass().getName() + ": " + e.getMessage());
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jBtnCerca;
private javax.swing.JComboBox jCmbCat;
private javax.swing.JLabel jLblTitolo;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JTable jTblProdotti;
private javax.swing.JButton jbtnAggiungi;
private javax.swing.JButton jbtnAnnulla2;
private javax.swing.JButton jbtnElimina;
private javax.swing.JButton jbtnGiu;
private javax.swing.JButton jbtnSu;
private javax.swing.JTextField jtxtCodice;
private javax.swing.JTextField jtxtProdotto;
private javax.swing.JLabel lblCognome;
private javax.swing.JLabel lblCognome1;
private javax.swing.JLabel lblCognome2;
private javax.swing.JPanel pnl1;
// End of variables declaration//GEN-END:variables
}

View File

@ -1,78 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" value="Aggiorna database..."/>
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
<Color id="Default Cursor"/>
</Property>
<Property name="resizable" type="boolean" value="false"/>
<Property name="type" type="java.awt.Window$Type" editor="org.netbeans.modules.form.editors.EnumEditor">
<Value id="POPUP"/>
</Property>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<Events>
<EventHandler event="windowClosed" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowClosed"/>
</Events>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="pnl1" alignment="1" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="pnl1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="pnl1">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel1" alignment="0" pref="377" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel1" alignment="0" pref="104" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="14" style="0"/>
</Property>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="Aggiornamento in corso..."/>
<Property name="horizontalTextPosition" type="int" value="0"/>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@ -1,167 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" value="Storno"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<Events>
<EventHandler event="windowClosed" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowClosed"/>
</Events>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="850" max="32767" attributes="0"/>
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Component id="pnl1" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="307" max="32767" attributes="0"/>
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="pnl1" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="pnl1">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jLblTitolo" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jScrollPane3" pref="768" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jbtnSu" alignment="0" min="-2" pref="60" max="-2" attributes="0"/>
<Component id="jbtnGiu" alignment="0" min="-2" pref="60" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jBtnOK" min="-2" pref="215" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jbtnAnnulla" min="-2" pref="215" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jLblTitolo" min="-2" pref="25" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane3" pref="223" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="jbtnSu" min="-2" pref="55" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jbtnGiu" min="-2" pref="53" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jBtnOK" alignment="3" min="-2" pref="36" max="-2" attributes="0"/>
<Component id="jbtnAnnulla" alignment="3" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane3">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTable" name="jTblStudenti">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="14" style="0"/>
</Property>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
<Table columnCount="0" rowCount="4"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="jbtnAnnulla">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Annulla"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jbtnAnnullaActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLblTitolo">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="0" green="0" red="ff" type="rgb"/>
</Property>
<Property name="horizontalAlignment" type="int" value="2"/>
<Property name="text" type="java.lang.String" value="Storno"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jBtnOK">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Storna"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jBtnOKActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jbtnSu">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jbtnSuActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jbtnGiu">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jbtnGiuActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>