I created a button but I don't know the line of code to change the position of the button.

it all depends on your code and what layoutmanager you are using.

^ like he said.
Post the code you use to create and set the initial position of the button, so someone can give you the appropriate answer.

here is the code

button  button = new JButton();

    public Mainmenu() {
        setLayout(new FlowLayout());

        Icon button1= new ImageIcon(getClass().getResource("button.jpg"));
        play=new JButton(button1);

        HandlerC hand = new HandlerC();

    private class HandlerC implements ActionListener {
        public void actionPerformed(ActionEvent e) {            


Where did you place the button. Please post ALL your code

this will tell you more about how to use/manipulate a UI using the FlowLayout.