You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.5 KiB

3 years ago
  1. package ui;
  2. import java.awt.event.ActionEvent;
  3. import java.awt.event.ActionListener;
  4. import javax.swing.BoxLayout;
  5. import javax.swing.JButton;
  6. import javax.swing.JFrame;
  7. import javax.swing.JLabel;
  8. import javax.swing.JPanel;
  9. import javax.swing.JTextArea;
  10. /**
  11. *
  12. * Creates a JFrame with a short text about the creators of the game code.
  13. *
  14. */
  15. class AboutFrame extends Object {
  16. private JFrame frame = new JFrame();
  17. AboutFrame() {
  18. JPanel aboutPanel = new JPanel();
  19. JLabel text = new JLabel("About", JLabel.CENTER);
  20. JTextArea field = new JTextArea(
  21. "This game was developed by Prof. Gepperth and Prof. Konert and the students of module Programming 2. It contains several levels of SpaceInvadersLevel style and BreakoutLevel style. The framework below allows quick creation of different 2d game types.");
  22. field.setBounds(25, 25, 80, 80);
  23. field.setLineWrap(true);
  24. field.setWrapStyleWord(true);
  25. field.setBackground(aboutPanel.getBackground());
  26. field.setEditable(false);
  27. JButton ok = new JButton("OK");
  28. ok.addActionListener(new ActionListener() {
  29. @Override
  30. public void actionPerformed(ActionEvent ae) {
  31. frame.setVisible(false);
  32. }
  33. });
  34. aboutPanel.setLayout(new BoxLayout(aboutPanel, BoxLayout.Y_AXIS));
  35. aboutPanel.add(text);
  36. aboutPanel.add(field);
  37. aboutPanel.add(ok);
  38. frame.add(aboutPanel);
  39. frame.setSize(400, 400);
  40. }
  41. protected void show() {
  42. frame.setVisible(true);
  43. }
  44. }