package framepaneltest;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
public class MyFramePanel extends JFrame implements ActionListener {
private JButton fine;
private MyEmptyPanel disegno;
private static final long serialVersionUID = 1L;
public MyFramePanel () {
setTitle("Finestra con area con disegno");
setLayout(new BorderLayout());
fine = new JButton("Fine");
disegno = new MyEmptyPanel();
fine.addActionListener(this);
add(disegno, BorderLayout.CENTER);
add(fine, BorderLayout.SOUTH);
pack();
}
@Override
public void actionPerformed(ActionEvent evt) {
if (evt.getSource() == fine) {
dispose();
}
}
}