hai ragione, ma ho iniziato a studiarmi il java solo la settimana scorsa e molte cose nn le so, sto imparando i concetti solo ora...volevo chiederti una cosa, con questo codice apro un form in cui cè un tasto che una volta pugiamto mi deve uscire una scritta su una label, avviene questo solo che la dimensione del form rimane piccola e la label nn si vede, qualè l'istruzione che ingrandisce la forma automaticamente?
mport javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JButton;
import javax.swing.JTextField;
import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.AbstractButton;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.ActionListener;
import java.awt.Dimension;
import java.awt.*;
class SimpleFrame extends JFrame implements ActionListener {
JTextField t = new JTextField("ci sono riuscito");
JLabel l = new JLabel("ciao", JLabel.CENTER);
JLabel ll = new JLabel("nflerkjelr", JLabel.CENTER);
SimpleFrame () {
super();
setTitle ("ScriptManager");
setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
//getContentPane().add(p);
//getContentPane().add(l);
JButton b = new JButton("Apri");
getContentPane().add(b, BorderLayout.PAGE_START);
b.addActionListener(this);//la funziona this attiva l'implements'
pack();
setVisible(true);
}
public static void main(String[] args) {
SimpleFrame sf = new SimpleFrame();
}
public void actionPerformed(ActionEvent e) {
getContentPane().add(ll);
//JFileChooser c = new JFileChooser();
//getContentPane().add(c);
}
}![]()