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.

AutoGUI.java 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package autogui;
  7. import commands.CommandInvoker;
  8. import controller.C_MenuListener;
  9. import controller.C_MenuListener_undo;
  10. import java.util.prefs.Preferences;
  11. import javax.swing.UIManager;
  12. import model.model;
  13. import view.gui;
  14. /**
  15. * AutoGUI
  16. * enthält alle wichtigen Parameter wie View, Model, CommandInvoker, Controller
  17. * @author matthias
  18. */
  19. public class AutoGUI {
  20. /**
  21. * @param args the command line arguments
  22. */
  23. private gui frm;
  24. //C_FileDialogOpen cfdo;
  25. //C_SaveFile csf;
  26. private Preferences prf;
  27. private final String PathID = "LastUsedPath";
  28. private final String FILE_ID = "LastUsedFile";
  29. private C_MenuListener cml;
  30. private C_MenuListener_undo cmlu;
  31. private model mdl;
  32. private CommandInvoker invoker;
  33. /**
  34. * Konstruktor initialisiert alle Parameter und registriert die Events und Commands
  35. */
  36. public AutoGUI()
  37. {
  38. this.prf = Preferences.userRoot().node(this.getClass().getName());
  39. //String test = this.prf.get(this.PathID, "abc"); // Leerer String falls get leer.
  40. this.frm = new gui();
  41. this.frm.setVisible(true);
  42. String lastPath = "Last used path: " + this.prf.get(this.PathID, "/");
  43. this.frm.getLblFilePath().setText(lastPath);
  44. this.mdl = new model();
  45. this.invoker = new CommandInvoker();
  46. this.cml = new C_MenuListener(this.frm, this.PathID, this.FILE_ID, this.prf, this.mdl, this.invoker);
  47. this.cml.registerEvents();
  48. this.cml.registerCommands(); /**INVOKER einfügen!!!!*/
  49. this.cmlu = new C_MenuListener_undo(this.frm, this.PathID, this.FILE_ID, this.prf, this.mdl, this.invoker);
  50. this.cmlu.registerEvents();
  51. }
  52. /**
  53. * Main erstellt AutoGUI und setzt LookAndFeel
  54. * @param args (String[])
  55. */
  56. public static void main(String[] args) {
  57. // TODO code application logic here
  58. new AutoGUI();
  59. try
  60. {
  61. UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  62. }
  63. catch(Exception ex){}
  64. }
  65. }