예제 #1
0
  private JPanel createButton(String num, String desc, boolean enabled) {
    JPanel pane = new JPanel(new FlowLayout(FlowLayout.LEFT, 8, 0));
    pane.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));

    JButton btn = new JButton("Tutorial" + num);
    btn.setPreferredSize(new Dimension(120, 25));
    btn.addActionListener(this);
    btn.setEnabled(enabled);
    btn.setFont(new Font("Verdana", Font.BOLD, 12));

    JLabel label = new JLabel(desc);
    label.setFont(new Font("Verdana", Font.PLAIN, 11));

    pane.add(btn);
    pane.add(label);

    return pane;
  }
예제 #2
0
  public Launcher() {
    super("Launch Tutorial Example");

    JPanel contentPane = new JPanel(new BorderLayout());

    JLabel label = new JLabel("GTGE Tutorial Example", JLabel.CENTER);
    label.setFont(new Font("Verdana", Font.PLAIN, 30));
    contentPane.add(label, BorderLayout.NORTH);

    JPanel pane = new JPanel(new GridLayout(0, 1));

    // Tutorial 4
    pane.add(createButton("4", "GTGE Game Skeleton", false));

    // Tutorial 5
    pane.add(createButton("5_1", "Empty Game in Windowed Mode"));
    pane.add(createButton("5_2", "Empty Game in Fullscreen Mode"));
    pane.add(
        createButton(
            "5_3", "Empty Game in Applet Mode (the game is embedded in Tutorial5_3.html)", false));

    // Tutorial 6
    pane.add(createButton("6", "Show all GTGE game engines basic usage"));

    // Tutorial 7
    pane.add(createButton("7_1", "Sprite"));
    pane.add(createButton("7_2", "Sprite in action"));
    pane.add(createButton("7_3", "Controlling sprite behaviour using Timer class"));

    // Tutorial 8
    pane.add(createButton("8_1", "Background"));
    pane.add(createButton("8_2", "Various background types"));
    pane.add(createButton("8_3", "Background view port"));

    // Tutorial 9
    pane.add(createButton("9_1", "Grouping sprites"));
    pane.add(createButton("9_2", "Removing sprite from group"));

    // Tutorial 10
    pane.add(createButton("10", "Collision in game"));

    // Tutorial 11
    pane.add(createButton("11", "Playfield for automate the game"));
    contentPane.add(pane, BorderLayout.CENTER);

    setContentPane(contentPane);
    pack();

    setResizable(false);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setLocationRelativeTo(null);
    setVisible(true);
  }