Cambio tipo file

This commit is contained in:
La Programmatrice Verde
2026-01-25 13:30:50 +01:00
parent b6d97a20ae
commit 52615c33aa
3 changed files with 76 additions and 192 deletions

View File

@@ -1,6 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
@@ -16,116 +23,13 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="31" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="txtPrezzo" pref="110" max="32767" attributes="0"/>
<Component id="lblPrezzo" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="txtQuantita" pref="121" max="32767" attributes="0"/>
<Component id="lblQuantita" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="21" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="lblImportoTotale" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="200" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="txtImportoTotale" max="32767" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="btnAggiungi" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="88" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<Group type="102" attributes="0">
<Component id="btnPrezzo" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="btnQuantita" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="btnTotale" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace min="0" pref="400" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="lblPrezzo" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblQuantita" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblImportoTotale" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="txtPrezzo" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="txtQuantita" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="txtImportoTotale" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnAggiungi" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="btnPrezzo" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnQuantita" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnTotale" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="26" max="32767" attributes="0"/>
</Group>
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="lblPrezzo">
<Properties>
<Property name="text" type="java.lang.String" value="Prezzo"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lblQuantita">
<Properties>
<Property name="text" type="java.lang.String" value="Quantit&#xe0;"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lblImportoTotale">
<Properties>
<Property name="text" type="java.lang.String" value="Importo totale"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="txtPrezzo">
</Component>
<Component class="javax.swing.JTextField" name="txtQuantita">
</Component>
<Component class="javax.swing.JTextField" name="txtImportoTotale">
<Properties>
<Property name="editable" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="btnPrezzo">
<Properties>
<Property name="text" type="java.lang.String" value="Media prezzo"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="btnQuantita">
<Properties>
<Property name="text" type="java.lang.String" value="Media quantit&#xe0;"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="btnTotale">
<Properties>
<Property name="text" type="java.lang.String" value="Tot. vendite"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="btnAggiungi">
<Properties>
<Property name="text" type="java.lang.String" value="Aggiungi"/>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@@ -1,6 +1,6 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JPanel.java to edit this template
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
*/
package guivendite;
@@ -8,7 +8,9 @@ package guivendite;
*
* @author Verde
*/
public class GUIVendite extends javax.swing.JPanel {
public class GUIVendite extends javax.swing.JFrame {
private static final java.util.logging.Logger logger = java.util.logging.Logger.getLogger(GUIVendite.class.getName());
/**
* Creates new form GUIVendite
@@ -26,100 +28,47 @@ public class GUIVendite extends javax.swing.JPanel {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
lblPrezzo = new javax.swing.JLabel();
lblQuantita = new javax.swing.JLabel();
lblImportoTotale = new javax.swing.JLabel();
txtPrezzo = new javax.swing.JTextField();
txtQuantita = new javax.swing.JTextField();
txtImportoTotale = new javax.swing.JTextField();
btnPrezzo = new javax.swing.JButton();
btnQuantita = new javax.swing.JButton();
btnTotale = new javax.swing.JButton();
btnAggiungi = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
lblPrezzo.setText("Prezzo");
lblQuantita.setText("Quantità");
lblImportoTotale.setText("Importo totale");
txtImportoTotale.setEditable(false);
btnPrezzo.setText("Media prezzo");
btnQuantita.setText("Media quantità");
btnTotale.setText("Tot. vendite");
btnAggiungi.setText("Aggiungi");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(31, 31, 31)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(txtPrezzo, javax.swing.GroupLayout.DEFAULT_SIZE, 110, Short.MAX_VALUE)
.addComponent(lblPrezzo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(txtQuantita, javax.swing.GroupLayout.DEFAULT_SIZE, 121, Short.MAX_VALUE)
.addComponent(lblQuantita, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(21, 21, 21)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(lblImportoTotale, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(200, 200, 200))
.addGroup(layout.createSequentialGroup()
.addComponent(txtImportoTotale)
.addGap(18, 18, 18)
.addComponent(btnAggiungi)
.addGap(88, 88, 88))))
.addGroup(layout.createSequentialGroup()
.addComponent(btnPrezzo)
.addGap(18, 18, 18)
.addComponent(btnQuantita)
.addGap(18, 18, 18)
.addComponent(btnTotale)
.addContainerGap())))
.addGap(0, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblPrezzo)
.addComponent(lblQuantita)
.addComponent(lblImportoTotale))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtPrezzo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtQuantita, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtImportoTotale, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnAggiungi))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnPrezzo)
.addComponent(btnQuantita)
.addComponent(btnTotale))
.addContainerGap(26, Short.MAX_VALUE))
.addGap(0, 300, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @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 (ReflectiveOperationException | javax.swing.UnsupportedLookAndFeelException ex) {
logger.log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(() -> new GUIVendite().setVisible(true));
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnAggiungi;
private javax.swing.JButton btnPrezzo;
private javax.swing.JButton btnQuantita;
private javax.swing.JButton btnTotale;
private javax.swing.JLabel lblImportoTotale;
private javax.swing.JLabel lblPrezzo;
private javax.swing.JLabel lblQuantita;
private javax.swing.JTextField txtImportoTotale;
private javax.swing.JTextField txtPrezzo;
private javax.swing.JTextField txtQuantita;
// End of variables declaration//GEN-END:variables
}

View File

@@ -0,0 +1,31 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package guivendite;
/**
*
* @author Verde
*/
public class Prodotto {
private final double quantita;
private final double prezzo;
public Prodotto(double quantita, double prezzo) {
this.quantita = quantita;
this.prezzo = prezzo;
}
public double getQuantita() {
return quantita;
}
public double getPrezzo() {
return prezzo;
}
public double getTotale(){
return prezzo*quantita;
}
}