I have made a Method the problem is that I can't get it to work when I place it in my project.
Either written the Method wrong or placing it in the wrong place in the project.
My Method
       void getSecond(int secondNum){
        displayTable.setText("\n"); //Clear the displayTable 
        int firstNum, answerNum;
            for (firstNum = 1; firstNum <=12; firstNum ++){
                answerNum = firstNum * secondNum;
                displayTable.append(firstNum + " x " + secondNum + " = " + answerNum +"\n");
             }
My Project
import javax.swing.*;
import java.awt.Color;
import java.awt.Font;
import javax.swing.BorderFactory; 
import javax.swing.border.Border;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
 
public class MyTables
{
 
	public static void main(String[] args) 
	{
		JFrame frame = new JFrame("Tables"); // Creating instance of JFrame
        frame.setSize(800, 600); // Setting the width and height of frame
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
		JPanel panel = new JPanel(); //Creating panel. Inside panels we can add textfields, buttons and other components.
		panel.setBorder(BorderFactory.createLineBorder(Color.RED));
        frame.add(panel); // Add panel to frame
        placeComponents(panel);  //Call user defined method for adding components to the panel.
		frame.setVisible(true); // Setting the frame visibility to true
    }
 
	private static void placeComponents(JPanel panel) 
	{
			panel.setLayout(null);
			JTextArea displayTable = new JTextArea("Text Area");
			displayTable.setEditable(false);
			displayTable.setColumns(20);
			displayTable.setFont(new Font("Times New Roman", 1, 14));
			displayTable.setLineWrap(true);
			displayTable.setRows(14);
			displayTable.setWrapStyleWord(true);
			displayTable.setBounds(200,20,230,260); 
			displayTable.setBorder(BorderFactory.createLineBorder(Color.GREEN));
			displayTable.setMaximumSize(new java.awt.Dimension(5, 22));
			panel.add(displayTable);
 
			JLabel userLabel = new JLabel("Enter a Number");  // Creating JLabel
			userLabel.setHorizontalAlignment(SwingConstants.CENTER);
			userLabel.setFont(new Font("Verdana", Font.ITALIC, 16)); //set font
			userLabel.setBounds(10,20,180,25); // Specifies the location and size of component. (x,y,x1,y1)
			userLabel.setBorder(BorderFactory.createLineBorder(Color.BLUE));	
			panel.add(userLabel); // Add Label to panel
 
			JTextField userText = new JTextField(20); //Create a textfield
			userText.setBounds(10,50,165,25);
			panel.add(userText); // Add TextField to pane
 
			JButton loginButton = new JButton("Enter"); // Create button
			loginButton.setBounds(10, 80, 80, 25);
			panel.add(loginButton); // Add loginButton to panel
 
 
		loginButton.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
				{
					//getSecond(6);
					displayTable.setText("Button Pressed");
				}
 
		});
    }		
}