Display A Random Tic-Tac-Toe Board Using Java Swing
Math.random is not very intuitive to use. Random makes it much easier. Create an instance of Random somewhere before the main loop, and generate the random indexes with random.nextInt(3) for values 0 1 2.

It's fine to use an array like you did to pick from the values randomly. When there are only few choices, like in this example, another option is to use a switch.

"display" is not a great name for an array of icons. icons would seem more natural.

A simple way to initialize an array:

ImageIcon[] icons = {
    new ImageIcon("images/x.gif"),
    new ImageIcon("images/o.gif"),
};