allora ho creato un vettore di tipo riga,composto così...
codice:
import java.awt.Rectangle;
import javax.swing.JComboBox;
import javax.swing.JTextField;
public class Riga {
JTextField articolo;
JTextField quantita;
JTextField prezzo;
JComboBox iva;
JTextField totale;
public Riga(int y) {
articolo = new JTextField();
articolo.setBounds(new Rectangle(24, y, 283, 25));
articolo.setText("articolo");
quantita = new JTextField();
quantita.setBounds(new Rectangle(321, y, 52, 25));
quantita.setText("0");
prezzo = new JTextField();
prezzo.setBounds(new Rectangle(390, y, 55, 25));
prezzo.setText("0,00");
iva = new JComboBox();
iva.setBounds(new Rectangle(459, 140, 64, 25));
iva.addItem("IVA");
totale = new JTextField();
totale.setBounds(new Rectangle(543, y, 46, 25));
totale.setText("0");
}
}
nel main vado a creare appunto un vettore di questo tipo...
una volta premuto il bottore pero non riesco a visualizzare le diverse componenti sopradescritte.
sicuramente sto saltando qualche passaggio che mi permetta di visualizzare la riga di oggetti sul pannello, sapete indicarmi qual è?
vi posto il pezzettino di codice relativo al bottone
codice:
private JButton getJButton() {
if (getJButton== null) {
getJButton= new JButton();
getJButton.setBounds(new Rectangle(413, 5, 161, 49));
getJButton.setText("genera");
getJButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
lista[numItem] = new Riga(y);
numItem++;
y += 40;
}
});
}
return jButton;
}