Hi!
You could define a method, let's say popUp():
private void popUp()
{
JFrame frame = new JFrame("aName");
frame.setSize(500, 500);
frame.setVisible(true);
}
Now, you should have an actionPerformed method:
public void actionPerformed(ActionEvent event)
{
if (event.getSource() == button1)
{
popUp();
}
}
Assuming, you have defined the following line:
button1.addActionListener(this);
Oh, and one more thing, your class has to implement the ActionListener interface.