Basta creare un nuovo JFrame e renderlo visibile nel blocco di codice che gestisce l'evento generato dal pulsante:
codice:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class NewFrame extends JFrame implements ActionListener{
public NewFrame(){
JButton newButton = new JButton("new window");
getContentPane().add(newButton);
newButton.addActionListener(this);
setTitle("window 1");
setSize(200, 200);
show();
}
public void actionPerformed(ActionEvent evt){
JFrame f = new JFrame();
f.setSize(200, 200);
f.setTitle("window 2");
f.setLocation(200, 200);
f.show();
}
public static void main(String[] args){
(new NewFrame()).show();
}
}