I have a program below that have 4 JSliders. I also have a grid that I drew using Graphics. The program updates the (x,y) positions of the drawLine (line). The program works as I want, but my problem is with the layout. How can I move the JSliders to all the way to the right of the JFrame?

Code:
package graph;

import java.awt.Color;
import javax.swing.JFrame;

public class Graph {

    public static void main(String[] args) {
        
        JFrame frame = new JFrame("Graph line between 2 points");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add(new graphPanel());
        frame.setResizable(false);
        frame.pack();
        frame.setVisible(true);
        
    }
}
Code:
package graph;

import java.awt.*;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

public class graphPanel extends JPanel{

    private int p1X, p1Y, p2X, p2Y;
    private JSlider p1, p2, p3, p4;    
    
    public graphPanel()
    {
        p1 = new JSlider(JSlider.VERTICAL, 0, 500, 0);
        p1.setMajorTickSpacing(100);
        p1.setPaintTicks(true);
        p1.setPaintLabels(true);
        p2 = new JSlider(JSlider.VERTICAL, 0, 500, 0);
        p2.setMajorTickSpacing(100);
        p2.setPaintTicks(true);
        p2.setPaintLabels(true);
        p3 = new JSlider(JSlider.VERTICAL, 0, 500, 0);
        p3.setMajorTickSpacing(100);
        p3.setPaintTicks(true);
        p3.setPaintLabels(true);
        p4 = new JSlider(JSlider.VERTICAL, 0, 500, 0);
        p4.setMajorTickSpacing(100);
        p4.setPaintTicks(true);
        p4.setPaintLabels(true);

        add(p1);
        add(p2);
        add(p3);
        add(p4);
        
        p1.addChangeListener(new sliderListener());
        p2.addChangeListener(new sliderListener());
        p3.addChangeListener(new sliderListener());
        p4.addChangeListener(new sliderListener());
        
        setPreferredSize(new Dimension(1000,500));
        setBackground(Color.BLACK);
    }
        
    public class sliderListener implements ChangeListener 
    {
        @Override
        public void stateChanged(ChangeEvent e) 
        {
            if(e.getSource() == p1)
            {
                p1X = p1.getValue();
            }
            
            if(e.getSource() == p2)
            {
                p1Y = p2.getValue();
            }
            
            if(e.getSource() == p3)
            {
                p2X = p3.getValue();
            }
            
            if(e.getSource() == p4)
            {
                p2Y = p4.getValue();
            }
        }
    }
    
    @Override
    public void paintComponent(Graphics g)
    {     
        super.paintComponent(g);
        
        g.setColor(Color.GREEN);
        
        g.drawLine(250, 0, 250, 500);
        g.drawLine(0, 250, 500, 250);
        
        g.drawString("Y", 275, 15);
        g.drawString("X", 485, 275);
        
        g.drawLine(240,25,260,25);
        g.drawLine(240,50,260,50);
        g.drawLine(240,75,260,75);
        g.drawLine(240,100,260,100);
        g.drawLine(240,125,260,125);
        g.drawLine(240,150,260,150);
        g.drawLine(240,175,260,175);
        g.drawLine(240,200,260,200);
        g.drawLine(240,225,260,225);
        
        g.drawLine(240,275,260,275);
        g.drawLine(240,300,260,300);
        g.drawLine(240,325,260,325);
        g.drawLine(240,350,260,350);
        g.drawLine(240,375,260,375);
        g.drawLine(240,400,260,400);
        g.drawLine(240,425,260,425);
        g.drawLine(240,450,260,450);
        g.drawLine(240,475,260,475);
        
        g.drawLine(25,240,25,260);
        g.drawLine(50,240,50,260);
        g.drawLine(70,240,70,260);
        g.drawLine(100,240,100,260);
        g.drawLine(125,240,125,260);
        g.drawLine(150,240,150,260);
        g.drawLine(175,240,175,260);
        g.drawLine(200,240,200,260);
        g.drawLine(225,240,225,260);
        
        g.drawLine(275,240,275,260);
        g.drawLine(300,240,300,260);
        g.drawLine(325,240,325,260);
        g.drawLine(350,240,350,260);
        g.drawLine(375,240,375,260);
        g.drawLine(400,240,400,260);
        g.drawLine(425,240,425,260);
        g.drawLine(450,240,450,260);
        g.drawLine(475,240,475,260);
        
        g.setColor(Color.BLUE);
        g.setFont(new Font("Helvetica", Font.PLAIN, 24));
        g.drawString("Point 1: ( " + p1X + ", " + p1Y + " )", 300, 400);
        g.drawString("Point 2: ( " + p2X + ", " + p2Y + " )", 300, 450);
        
        g.setColor(Color.red);
        g.drawLine(p1X, p1Y, p2X, p2Y);
        
        repaint();
    }           
}