Hello, I am fairly new to working with GUI. I have created a small test program because I am having trouble aligning JLabels in one of the programs I am currently working on (a Resume Maker). Here is the test program:

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

public class Test implements ActionListener{
JFrame frame;
JPanel contentPane;
JLabel p1, p2, p3;

public Test(){
frame = new JFrame("Test Label Alignment");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);

contentPane = new JPanel();
contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.PAGE_AXIS));
contentPane.setBorder(BorderFactory.createEmptyBor der(10,10,10,10));

p1 = new JLabel("eeeeee413");
p1.setAlignmentX(JLabel.RIGHT_ALIGNMENT);
contentPane.add(p1);

p2 = new JLabel("yyyyy2");
p2.setAlignmentX(JLabel.LEFT_ALIGNMENT);
contentPane.add(p2);

p3 = new JLabel("3333333331");
p3.setAlignmentX(JLabel.LEFT_ALIGNMENT);
contentPane.add(p3);

frame.setContentPane(contentPane);

frame.pack();
frame.setVisible(true);
}

public void actionPerformed(ActionEvent event){
String eventName = event.getActionCommand();
}

private static void runGUI(){
JFrame.setDefaultLookAndFeelDecorated(true);

Test myGrades = new Test();
}

public static void main(String[] args){
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run(){
runGUI();
}
});
}
}

As you can see, I am trying to make "eeeeee413" aligned on the right of the JFrame, and "yyyyy2" and "3333333331" both aligned on the left of the JFrame.

The actual output shows "eeeeee413" aligned on the left of the JFrame, and "yyyyy2" and "3333333331" both aligned on the right of the JFrame.

Any help would be greatly appreciated :D