Hello,

I noticed in this video: https://www.youtube.com/watch?v=jJjg4JweJZU that bucky's OK button is in the center of the line.
When I make the exact same thing in my program that I'm working on, it alligns the OK button to the right.

Now my question is, how can I change it so that the button is in the middle of the line it's on?

Here's my code:

import javax.swing.*;
public class head {
public static void main(String[] args) {
JOptionPane.showMessageDialog(null, "Welcome to the second degree polynomials program\n\nClick OK to continue", "welcome", JOptionPane.PLAIN_MESSAGE);
JTextField field1 = new JTextField();
JTextField field2 = new JTextField();
JTextField field3 = new JTextField();
JTextField Discfield = new JTextField();
JTextField x1field = new JTextField();
JTextField x2field = new JTextField();

Object[] message = {
    "Input value a:", field1,
    "Input value b:", field2,
    "Input value c:", field3,
};
int test = 0;
do{
int option = JOptionPane.showConfirmDialog(null, message, "Enter all your values", JOptionPane.OK_CANCEL_OPTION);
if (option == JOptionPane.OK_OPTION){
   
String value1 = field1.getText();
    String value2 = field2.getText();
    String value3 = field3.getText();
   
    double a = Double.parseDouble(value1);
    double b = Double.parseDouble(value2);
    double c = Double.parseDouble(value3);
   
    double Disc  = (b*b) - 4*a*c;
    double x1 = ((-b+Math.sqrt(Disc))/(2*a));
    double x2 = ((-b-Math.sqrt(Disc))/(2*a));
   
    String DiscString = Double.toString(Disc);
    String x1String = Double.toString(x1);
    String x2String = Double.toString(x2);
   
    Object[] message2 = {
    "Discriminant", Discfield,
    "x1", x1field,
    "x2", x2field,
    };
   
    Discfield.setText(DiscString);
    x1field.setText(x1String);
    x2field.setText(x2String);
   
    JOptionPane.showMessageDialog(null, message2);
   
    int question = JOptionPane.showConfirmDialog(null, "Do you want the product and the sum?", "question", JOptionPane.YES_NO_OPTION);
    if (question == JOptionPane.YES_OPTION){
    JTextField sumfield = new JTextField();
    JTextField prodfield = new JTextField();
   
    double sum = (-b)/a;
    double product = c/a;
   
    Object[] snp = {
    "Sum", sumfield,
    "Product", prodfield,
    };
   
    sumfield.setText(Double.toString(sum));
    prodfield.setText(Double.toString(product));
   
    JOptionPane.showMessageDialog(null, snp);
    JOptionPane.showConfirmDialog(null, "Thank you for using this program!\nMade By Gijs Vermeulen", "Thank you", JOptionPane.PLAIN_MESSAGE);
    test = 1;
    }
    else {
    JOptionPane.showConfirmDialog(null, "Thank you for using this program!\nMade By Gijs Vermeulen", "Thank you", JOptionPane.PLAIN_MESSAGE);
    test = 1;
    }
}
else{
JOptionPane.showConfirmDialog(null, "Thank you for using this program!\nMade By Gijs Vermeulen", "Thank you", JOptionPane.PLAIN_MESSAGE);
test = 1;
}
}while(test == 0);
}
}

I'm talking about the JOptionPane.showMessageDialog lines. In every one of them the ok button is on the right of the screen and I want it in the middle.

Any help would be very appreciated.