@SuppressWarnings("HardCodedStringLiteral")
  public static void main(String[] args) throws IOException {
    final JBCardLayout cardLayout = new JBCardLayout();

    JFrame f = new JFrame();
    JPanel p = new JPanel(new BorderLayout());
    final JPanel centerPanel = new JPanel(cardLayout);
    for (int i = 0; i < 10; i++) {
      JLabel l = new JLabel("Page #" + (i + 1), SwingConstants.CENTER);
      l.setOpaque(true);
      int red = 50 + (int)(Math.random() * 100);
      int green = 50 + (int)(Math.random() * 100);
      int blue = 50 + (int)(Math.random() * 100);
      l.setForeground(new Color(red, green, blue));
      red = 255 - (int)(Math.random() * 55);
      green = 255 - (int)(Math.random() * 55);
      blue = 255 - (int)(Math.random() * 55);
      l.setBackground(new Color(red, green, blue));
      l.setFont(l.getFont().deriveFont(40F));
      centerPanel.add(l, "page" + i);
    }
    final int[] cursor = new int[1];
    JButton prevButton = new JButton("<<");
    JButton nextButton = new JButton(">>");
    prevButton.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        cursor[0]--;
        if (cursor[0] < 0) {
          cursor[0] = 9;
        }
        cardLayout.swipe(centerPanel, "page" + cursor[0], SwipeDirection.BACKWARD);
      }
    });
    nextButton.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        cursor[0] = (cursor[0] + 1) % 10;
        cardLayout.swipe(centerPanel, "page" + cursor[0], SwipeDirection.FORWARD);
      }
    });

    p.setLayout(new BorderLayout());
    p.add(prevButton, BorderLayout.WEST);
    p.add(centerPanel, BorderLayout.CENTER);
    p.add(nextButton, BorderLayout.EAST);
    f.setContentPane(p);
    f.setSize(JBUI.size(600, 800));
    f.setLocationRelativeTo(null);
    f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    f.setVisible(true);
  }
@SuppressWarnings("HardCodedStringLiteral")
  public static void main(String[] args)