ConsoleController.java 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. public class ConsoleController {
  8. private Model MODEL;
  9. public ConsoleController(Model model) {
  10. this.MODEL = model;
  11. }
  12. /**
  13. * Print Text on the console
  14. *
  15. * @param text
  16. * String the Text
  17. * @param color
  18. * the color of the Text
  19. * @param p
  20. * size of the Text
  21. * @param bold
  22. * bold or not
  23. * @param italic
  24. * italic or not
  25. * @param ln
  26. * new line or not
  27. *
  28. * @return selected CpsObject
  29. */
  30. public void addTextToConsole(String text, Color color, int p, boolean bold, boolean italic, boolean nl) {
  31. MODEL.getConsole().addText(text, color, p, bold, italic, nl);
  32. }
  33. /**
  34. * Print Text on the console in black and font size 12
  35. *
  36. * @param text
  37. * String the Text
  38. */
  39. public void addTextToConsole(String text) {
  40. MODEL.getConsole().addText(text);
  41. }
  42. /**
  43. * Clears the console
  44. */
  45. public void clearConsole() {
  46. MODEL.getConsole().clearConsole();
  47. }
  48. }