Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    [Java] Passaggio valori tra frame

    io ho questo frame:
    codice:
    public class FormModifica extends javax.swing.JFrame {
    
        private String name;
        Object author;
        Object editor;
        String price;
        String isbn;
        String note;
    
        public FormModifica(String name, Object author, Object editor, String price, String isbn, String note) {
            this.name = name;
            this.author = author;
            this.editor = editor;
            this.price = price;
            this.isbn = isbn;
            this.note = note;
        }
    
        public FormModifica() {
            initComponents();
            setLocationRelativeTo(null);
        }
    .........
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
    
                public void run() {
                    try {
                        String hifi = "com.jtattoo.plaf.hifi.HiFiLookAndFeel";
                        UIManager.setLookAndFeel(hifi);
                        new FormModifica().setVisible(true);
                    } catch (UnsupportedLookAndFeelException ex) {
                        JOptionPane.showMessageDialog(null, ex.getMessage());
                    } catch (ClassNotFoundException ex) {
                        JOptionPane.showMessageDialog(null, ex.getMessage());
                    } catch (InstantiationException ex) {
                        JOptionPane.showMessageDialog(null, ex.getMessage());
                    } catch (IllegalAccessException ex) {
                        JOptionPane.showMessageDialog(null, ex.getMessage());
                    }
                }
            });
        }
    dovrei riempire le textfield con valori che arrivano da un altro frame:
    codice:
    FormModifica form = new FormModifica(name, author_id, editor_id, note, isbn, note);
    form.setVisible(true);
    il mio problema è che il FormModifica nn si avvia.
    più o meno penso di aver capito dov'è il problema.
    ma nn riesco a risolverlo.

  2. #2
    Beh.. Prova a mettere initComponents(); anche dentro il tuo costruttore..

  3. #3
    Ma per caso stai facendo il progetto di programmazione a oggetti del prof Roncato??

  4. #4
    Originariamente inviato da bravemouse
    Beh.. Prova a mettere initComponents(); anche dentro il tuo costruttore..
    l'avevo fatto ma nn funzionava.
    l'ho rifatto adesso facendo un clean e rebuild e ha funzionato.
    forse prima la compilazione nn era andata bene.
    scusate la domanda inutile.
    grazie!

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.