This commit is contained in:
La Programmatrice Verde
2026-01-25 11:27:06 +01:00
parent 6077f08426
commit b6d97a20ae
2 changed files with 241 additions and 55 deletions

View File

@@ -0,0 +1,131 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<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="3"/>
<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 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>
</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>
</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,70 +1,125 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JPanel.java to edit this template
*/
package guivendite;
import java.util.InputMismatchException;
import java.util.Scanner;
/**
*
* @author Verde
*/
public class GUIVendite {
public class GUIVendite extends javax.swing.JPanel {
/**
* @param args the command line arguments
* Creates new form GUIVendite
*/
static Scanner sc = new Scanner(System.in);
static final String ERRORE_GENERICO = "Errore: opzione non valida.";
public static void main(String[] args) {
int scelta = -1;
do {
System.out.println("Scegliere un'opzione:");
System.out.println("1. ");
System.out.println("2. ");
System.out.println("3. ");
System.out.println("0. Esci");
System.out.print("Opzione: ");
try {
scelta = sc.nextInt();
sc.nextLine();
switch (scelta) {
case 0:
break;
case 1:
pausa();
break;
case 2:
pausa();
break;
case 3:
pausa();
break;
default:
System.out.println(ERRORE_GENERICO);
pausa();
break;
}
}
catch (InputMismatchException _) {
System.out.println(ERRORE_GENERICO);
pausa();
}
} while (scelta != 0);
public GUIVendite() {
initComponents();
}
public static void pausa() {
System.out.println("Premere un tasto per continuare. . .");
sc.nextLine();
}
/**
* 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() {
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();
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);
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())))
);
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))
);
}// </editor-fold>//GEN-END:initComponents
// 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
}