Changing the font of a JMenuItem

You can either embed HTML in the JMenuItem’s text, or you can call the method setFont.

Main.java:

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 menuItem1 = new JMenuItem("<html><font size=-1>male</font></html>");
      JMenuItem menuItem2 = new JMenuItem("<html><font size=+1>female</font></html>");
      JMenuItem menuItem3 = new JMenuItem("androgyne");
      menuItem3.setFont(new Font("Monospaced", Font.ITALIC, 36));
 
      // add the MenuItems to the Menu 
      menu.add(menuItem1);
      menu.add(menuItem2);
      menu.add(menuItem3);
 
      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();
   }
}