I have created 2 JButtons but both open the same file how do i make the second button open another file........................................................................................................................................................
//Starting Page
import javax.swing.*;
import java.awt.event.*;
import java.awt. *;
import java.io.*;
public class AddressBook implements ActionListener // Create a new class Address Book
{
JFrame Start=new JFrame("Address Book"); // Set name of Frame
JButton Open; // Set new button
JButton Second;
{
Open=new JButton("OPEN"); // set name of button
Second=new JButton("Second");
Start.setSize(500,600); // set size of frame
Start.add(new JLabel(new ImageIcon("backgroundforlab.jpg"))); // add background picture
Start.setVisible(true);
Start.setLayout(null);
Start.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
Start.getContentPane().add(Open); //Make button visible
Start.getContentPane().add(Second);
Open.setBounds(100,385,295,88);
Second.setBounds(50,160,150,44); // set size of button
Open.addActionListener(this);
Second.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
Start.dispose(); // When button is clicked close frame and open mainMenu
mainMenu A=new mainMenu();
}
public static void main(String ag[])
{
AddressBook A=new AddressBook(); // run class AddressBook
}
}