Add JPanel to JFrame
I would recommend:


You're using a GridLayout(2, 3) -- good.
I'd make it actually a GridLayout(2, 0, GAP, GAP) where GAP is a constant that allows a gap between JLabels. The first and second parameters mean 2 rows with variable number of columns.
Then if you set the background color of the JPanel to yellow, make the JLabels opaque and white, give the background JPanel an empty border of GAP width, you've got your yellow borders
Use an enum to combine a Color with a String. An alternative to this could be to use a Map&lt;String, Color&gt;
The enum method values() would then return an array of all the items of that enum. If using the Map such as a HashMap, you'd get the key set and iterate through this.
You could then use a simple for loop to iterate through this array, creating JLabels that have the desired text and the desired foreground colors.
You risk painting yourself in a corner by having your class extend JFrame, forcing you to create and display JFrames, when often more flexibility is often called for. In fact, I would venture that most of the Swing GUI code that I've created and that I've seen does not extend JFrame, and in fact it is rare that you'll ever want to do this. More commonly your GUI classes will be geared towards creating JPanels, which can then be placed into JFrames or JDialogs, or JTabbedPanes, or swapped via CardLayouts, wherever needed. This can greatly increase the flexibility of your GUI coding. 




For example, 

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import javax.swing.*;

@SuppressWarnings("serial")
public class SixLabels2 extends JPanel {
   private static final int GAP = 8;
   private static final int LABEL_WIDTH = 160;
   private static final Dimension LABEL_SIZE = new Dimension(LABEL_WIDTH, LABEL_WIDTH);
   private static final int ROWS = 2;
   private static final Font LABEL_FONT = new Font("Times New Roman", Font.BOLD, 20);

   public SixLabels2() {
      setBackground(Color.yellow);
      setLayout(new GridLayout(ROWS, 0, GAP, GAP)); 
      setBorder(BorderFactory.createEmptyBorder(GAP, GAP, GAP, GAP));

      // iterate through all the items in the MyColor enum
      for (MyColor myColor : MyColor.values()) {
         JLabel label = new JLabel(myColor.getText(), SwingConstants.CENTER);
         label.setForeground(myColor.getColor());
         label.setPreferredSize(LABEL_SIZE);
         label.setFont(LABEL_FONT);
         label.setOpaque(true);
         label.setBackground(Color.white);
         add(label);
      }
   }

   private static void createAndShowGui() {
      SixLabels2 mainPanel = new SixLabels2();

      JFrame frame = new JFrame("SixLabels2");
      frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
      frame.getContentPane().add(mainPanel);
      frame.pack();
      frame.setLocationByPlatform(true);
      frame.setVisible(true);
   }

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

enum MyColor {
   BLACK("Black", Color.black), BLUE("Blue", Color.blue), 
   CYAN("Cyan", Color.cyan), GREEN("Green", Color.green), 
   MAGENTA("Magenta", Color.magenta), ORANGE("Orange", Color.orange);

   private String text;
   private Color color;

   private MyColor(String text, Color color) {
      this.text = text;
      this.color = color;
   }

   public String getText() {
      return text;
   }

   public Color getColor() {
      return color;
   }

   @Override
   public String toString() {
      return text;
   }

}




Note, my code may not be actually shorter in length, but I'll wager that it's easier to debug and enhance. Consider adding a few more colors to your code and mine and see how many variables and statements need to be changed in both. For instance, if you wanted to add two more colors to mine, all you'd need to do would be to change the enum to include two more colors. The program would take care of the rest for you.

For example, if you changed the enum from this:

enum MyColor {
   BLACK("Black", Color.black), BLUE("Blue", Color.blue), 
   CYAN("Cyan", Color.cyan), GREEN("Green", Color.green), 
   MAGENTA("Magenta", Color.magenta), ORANGE("Orange", Color.orange);


to this:

enum MyColor {
   BLACK("Black", Color.black), BLUE("Blue", Color.blue), 
   CYAN("Cyan", Color.cyan), GREEN("Green", Color.green), 
   MAGENTA("Magenta", Color.magenta), ORANGE("Orange", Color.orange),
   GRAY("Gray", Color.gray), FOO("Foo", new Color(100, 250, 255));


The GUI would then automatcially accommodate the additional colors.