Getting a list of all display modes

From JDK1.4, you can use the class DisplayMode. Get the current GraphicsDevice, and call the method getDisplayModes.

import javax.swing.*;
import java.awt.*;
public class Main extends JFrame {
   public static void main(String[] args) {
      GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment ();
      GraphicsDevice gd = ge.getDefaultScreenDevice ();
      DisplayMode dp[] = gd.getDisplayModes();
      for (int i=0; i<dp.length; i++) {
         int width = dp[i].getWidth();
         int height = dp[i].getHeight();
         int bitDepth = dp[i].getBitDepth();
         int refreshRate = dp[i].getRefreshRate();
         System.out.println(width + "x" + height + " " + 
                            bitDepth + "bit " + 
                            (refreshRate == 0 ? "unknown" : ""+refreshRate + "hz"));

outputs on my machine:

640x480 8bit unknown
800x600 8bit unknown
1024x768 8bit unknown
1152x864 8bit unknown
1280x1024 8bit unknown
640x480 16bit unknown
800x600 16bit unknown
1024x768 16bit unknown
1152x864 16bit unknown
1280x1024 16bit unknown
640x480 32bit unknown
800x600 32bit unknown
1024x768 32bit unknown
1152x864 32bit unknown
1280x1024 32bit unknown