Q:

How can i add button to new line without layout?

This is my first gui project so if it's a dumb question please forgive me. 
I should add 25 buttons to panel in 5 rows with 5 buttons each row. It must be like 5X5 matrix. But I can't use layout in this project. So I have to do this without layout.
Here is my code for adding the buttons:
for(int i=0;i<25;i++)
        {   
        b=new JButton();
        b.setLocation(0, 0);
        b.setPreferredSize(new Dimension(40, 40));
        b.setEnabled(true);
        panel.add(b);
        }

A:

EDIT: Updated to a working MCVE

The easiest would be to treat the rows and columns separately, with two nested for-loops. This is done in the method addButtonsA in the example below.
Alternatively, you can compute the current row and column from the loop variable (which runs from 0 to 25), as it is done in the addButtonsB method.
Note that, in any case, when you are not using a layout manager, you have to specify the size of the buttons by calling setSize. (Usually, when you are using a layout manager, you have to use setPreferredSize, but not in this case).
The example:
import java.awt.Dimension;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

public class ManualButtonGrid
{
    public static void main(String[] args)
    {
        SwingUtilities.invokeLater(new Runnable()
        {
            @Override
            public void run()
            {
                createAndShowGUI();
            }
        });
    }

    private static void createAndShowGUI()
    {
        JFrame f = new JFrame();
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        JPanel panel = new JPanel();
        panel.setLayout(null);

        int numRows = 5;
        int numCols = 5;

        //addButtonsA(panel, numRows, numCols);
        addButtonsB(panel, numRows, numCols);

        f.getContentPane().add(panel);
        f.setSize(500,500);
        f.setLocationRelativeTo(null);
        f.setVisible(true);
    }

    private static void addButtonsA(JPanel panel, int numRows, int numCols)
    {
        int size = 60;
        for (int r = 0; r < numRows; r++)
        {
            for (int c = 0; c < numCols; c++)
            {
                JButton b = new JButton(String.valueOf(r*numCols+c));
                b.setLocation(c*size, r*size);
                b.setSize(new Dimension(size, size));
                panel.add(b);
            }
        }
    }

    private static void addButtonsB(JPanel panel, int numRows, int numCols)
    {
        int size = 60;
        for (int i = 0; i < 25; i++)
        {
            JButton b = new JButton(String.valueOf(i));
            int r = i / numCols;
            int c = i % numCols;
            b.setLocation(c*size, r*size);
            b.setSize(new Dimension(size, size));
            panel.add(b);
        }
    }

}

