import javax.swing.*; import java.awt.event.*; class Program extends JFrame { JButton masikgomb; Program() { masikgomb = new JButton("Masik"); masikgomb.addActionListener(new MasikGombClick()); masikgomb.setBounds( 50, 50, 100, 25); add(masikgomb); setLayout(null); setDefaultCloseOperation(JDialog.EXIT_ON_CLOSE); setSize(400, 300); setVisible(true); } public static void main(String[] argv) { new Program(); } class MasikGombClick implements ActionListener { public void actionPerformed(ActionEvent e) { Parbeszed parbeszed = new Parbeszed(); parbeszed.show(); } } class Parbeszed extends JDialog { Parbeszed() { setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); setSize(400, 300); setLocationRelativeTo(this); setVisible(true); } } }