From b6d97a20aeacd42f9e2ec5b3666f74fd82d8cbc8 Mon Sep 17 00:00:00 2001 From: La Programmatrice Verde Date: Sun, 25 Jan 2026 11:27:06 +0100 Subject: [PATCH] Finestra --- src/guivendite/GUIVendite.form | 131 ++++++++++++++++++++++++++ src/guivendite/GUIVendite.java | 165 ++++++++++++++++++++++----------- 2 files changed, 241 insertions(+), 55 deletions(-) create mode 100644 src/guivendite/GUIVendite.form diff --git a/src/guivendite/GUIVendite.form b/src/guivendite/GUIVendite.form new file mode 100644 index 0000000..3117ab6 --- /dev/null +++ b/src/guivendite/GUIVendite.form @@ -0,0 +1,131 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/guivendite/GUIVendite.java b/src/guivendite/GUIVendite.java index b2e34e0..4d3e14c 100644 --- a/src/guivendite/GUIVendite.java +++ b/src/guivendite/GUIVendite.java @@ -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") + // //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)) + ); + }// //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 }