ConsoleController.java 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. package ui.controller;
  2. import java.awt.Color;
  3. import javax.swing.text.BadLocationException;
  4. import javax.swing.text.StyleConstants;
  5. import ui.model.Model;
  6. import ui.view.Console;
  7. /**
  8. * Controller for the Canvas.
  9. *
  10. * @author Gruppe14
  11. */
  12. public class ConsoleController {
  13. private Model model;
  14. /**
  15. * Constructor.
  16. *
  17. * @param model
  18. * the Model
  19. */
  20. public ConsoleController(Model model) {
  21. this.model = model;
  22. }
  23. /**
  24. * Print Text on the console.
  25. *
  26. * @param text
  27. * String the Text
  28. * @param color
  29. * the color of the Text
  30. * @param p
  31. * size of the Text
  32. * @param bold
  33. * bold or not
  34. * @param italic
  35. * italic or not
  36. * @param nl
  37. * new line or not
  38. *
  39. **/
  40. public void addTextToConsole(String text, Color color, int p, boolean bold, boolean italic, boolean nl) {
  41. model.getConsole().addText(text, color, p, bold, italic, nl);
  42. }
  43. /**
  44. * Print Text on the console in black and font size 12.
  45. *
  46. * @param text
  47. * String the Text
  48. */
  49. public void addTextToConsole(String text) {
  50. model.getConsole().addText(text);
  51. }
  52. /**
  53. * Clears the console.
  54. */
  55. public void clearConsole() {
  56. model.getConsole().clearConsole();
  57. }
  58. }