Justifying the text on a JMenuItem

You have a number of functions:setHorizontalAlignment, setHorizontalTextPosition, setVerticalAlignment, setVerticalTextPosition. Look at the API docs for more information about their behaviour.

Main.java:

import javax.swing.event.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
   
public class Main extends JFrame {
   public Main() {
      getContentPane().setLayout(new FlowLayout());
 
      JMenuBar menuBar = new JMenuBar();
      JMenu menu = new JMenu("Sex");
      JMenuItem menuItem0 = new JMenuItem("NO ALIGNMENT");
      JMenuItem menuItem1 = new JMenuItem("CENTER");
      JMenuItem menuItem2 = new JMenuItem("LEFT");
      JMenuItem menuItem3 = new JMenuItem("RIGHT");
      JMenuItem menuItem4 = new JMenuItem("LEADING");
      JMenuItem menuItem5 = new JMenuItem("TRAILING");
 
      // add the MenuItems to the Menu 
      menu.add(menuItem0);
      menu.add(menuItem1);
      menu.add(menuItem2);
      menu.add(menuItem3);
      menu.add(menuItem4);
      menu.add(menuItem5);
   
      menuItem1.setHorizontalAlignment(SwingConstants.CENTER);
      menuItem2.setHorizontalAlignment(SwingConstants.LEFT);
      menuItem3.setHorizontalAlignment(SwingConstants.RIGHT);
      menuItem4.setHorizontalAlignment(SwingConstants.LEADING);
      menuItem5.setHorizontalAlignment(SwingConstants.TRAILING);
 
      menuBar.add(menu);
 
      this.setJMenuBar(menuBar); 
 
      addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent event) {
            System.exit(0);   
         }      
      });
 
      setSize(400, 400);
   }
 
   public static void main(String[] args) {
      (new Main()).show();
   }
}