codice:
package Anagrafica; import java.awt.GraphicsEnvironment; import java.awt.Rectangle; import javax.swing.JInternalFrame; import javax.swing.JMenuItem; import javax.swing.JPanel; import java.awt.Dimension; import javax.swing.JLabel; import javax.swing.JComboBox; import javax.swing.JButton; import javax.swing.JTextField; public class Frm_Fattura extends JInternalFrame { private static final long serialVersionUID = 1L; private JPanel jContentPane = null; private JMenuItem itemAssociato = null; private JLabel jLabelTitolo = null; private JLabel jLabelNomeCliente = null; private JComboBox jComboBoxNomeCliente = null; private JButton jButtonAggiungi = null; private JLabel jLabelArticolo = null; private JLabel jLabelQuant = null; private JLabel jLabelPrezzo = null; private JLabel jLabelIVA = null; private JTextField jTextFieldArticolo = null; private JTextField jTextFieldQuant = null; private JTextField jTextFieldPrezzo = null; private JComboBox jComboBoxIVA = null; private JTextField jTextFieldTotale = null; private JLabel jLabelTotale = null; private JPanel jPanelContenitore = null; public Frm_Fattura(JMenuItem item) { super(); this.itemAssociato = item; initialize(); } private void initialize() { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); Rectangle maxSize = ge.getMaximumWindowBounds(); this.setBounds((int)(maxSize.width - 800) / 2, (int)(maxSize.height - 600) / 2, 750, 500); this.setTitle("Nuova Fattura"); this.setContentPane(getJContentPane()); this.setSize(new Dimension(662, 481)); this.setClosable(true); this.setResizable(true); this.setIconifiable(true); this.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter() { public void internalFrameClosed(javax.swing.event.InternalFrameEvent e) { itemAssociato.setEnabled(true); } }); } private JPanel getJContentPane() { if (jContentPane == null) { jLabelTotale = new JLabel(); jLabelTotale.setBounds(new Rectangle(535, 109, 52, 27)); jLabelTotale.setText("Totale"); jLabelIVA = new JLabel(); jLabelIVA.setBounds(new Rectangle(465, 109, 35, 25)); jLabelIVA.setText("IVA "); jLabelPrezzo = new JLabel(); jLabelPrezzo.setBounds(new Rectangle(396, 109, 48, 25)); jLabelPrezzo.setText("Prezzo"); jLabelQuant = new JLabel(); jLabelQuant.setBounds(new Rectangle(321, 109, 52, 25)); jLabelQuant.setText("Quantità"); jLabelArticolo = new JLabel(); jLabelArticolo.setBounds(new Rectangle(24, 109, 92, 25)); jLabelArticolo.setText("Nome Articolo"); jLabelNomeCliente = new JLabel(); jLabelNomeCliente.setBounds(new Rectangle(25, 55, 80, 25)); jLabelNomeCliente.setText("Nome Cliente"); jLabelTitolo = new JLabel(); jLabelTitolo.setBounds(new Rectangle(253, 12, 132, 29)); jLabelTitolo.setText("Inserisci Nuova Fattura"); jContentPane = new JPanel(); jContentPane.setLayout(null); jContentPane.add(jLabelTitolo, null); jContentPane.add(jLabelNomeCliente, null); jContentPane.add(getJComboBoxNomeCliente(), null); jContentPane.add(getJButtonAggiungi(), null); jContentPane.add(jLabelArticolo, null); jContentPane.add(jLabelQuant, null); jContentPane.add(jLabelPrezzo, null); jContentPane.add(jLabelIVA, null); jContentPane.add(jLabelTotale, null); jContentPane.add(getJPanelContenitore(), null); } return jContentPane; } private JComboBox getJComboBoxNomeCliente() { if (jComboBoxNomeCliente == null) { jComboBoxNomeCliente = new JComboBox(); jComboBoxNomeCliente.setBounds(new Rectangle(120, 55, 203, 25)); } return jComboBoxNomeCliente; } private JButton getJButtonAggiungi() { if (jButtonAggiungi == null) { jButtonAggiungi = new JButton(); jButtonAggiungi.setBounds(new Rectangle(423, 55, 171, 27)); jButtonAggiungi.setText("Aggiungi Articolo"); } return jButtonAggiungi; } private JTextField getJTextFieldArticolo() { if (jTextFieldArticolo == null) { jTextFieldArticolo = new JTextField(); jTextFieldArticolo.setBounds(new Rectangle(6, 157, 283, 25)); } return jTextFieldArticolo; } private JTextField getJTextFieldQuant() { if (jTextFieldQuant == null) { jTextFieldQuant = new JTextField(); jTextFieldQuant.setBounds(new Rectangle(303, 157, 51, 25)); } return jTextFieldQuant; } private JTextField getJTextFieldPrezzo() { if (jTextFieldPrezzo == null) { jTextFieldPrezzo = new JTextField(); jTextFieldPrezzo.setBounds(new Rectangle(372, 157, 55, 25)); } return jTextFieldPrezzo; } private JComboBox getJComboBoxIVA() { if (jComboBoxIVA == null) { jComboBoxIVA = new JComboBox(); jComboBoxIVA.setBounds(new Rectangle(441, 157, 50, 24)); } return jComboBoxIVA; } private JTextField getJTextFieldTotale() { if (jTextFieldTotale == null) { jTextFieldTotale = new JTextField(); jTextFieldTotale.setBounds(new Rectangle(506, 157, 67, 25)); } return jTextFieldTotale; } private JPanel getJPanelContenitore() { if (jPanelContenitore == null) { jPanelContenitore = new JPanel(); jPanelContenitore.setLayout(null); jPanelContenitore.setBounds(new Rectangle(1, 140, 650, 197)); jPanelContenitore.add(getJTextFieldArticolo(), null); jPanelContenitore.add(getJTextFieldQuant(), null); jPanelContenitore.add(getJTextFieldPrezzo(), null); jPanelContenitore.add(getJComboBoxIVA(), null); jPanelContenitore.add(getJTextFieldTotale(), null); } return jPanelContenitore; } }
in pratica vorrei che jTextFieldArticolo, jTextFieldQuant, jTextFieldPrezzo jComboBoxIVA, jTextFieldTotale quando pigio sul bottone jButtonAggiungi, debbano esser duplicate in modo da poter effettuare un nuovo inserimento, il tutto racchiudendole all'interno di un'area su cui applicare lo scrolling...tutto qui.grazie ciao